Bkash Technical
Bkash Technical
Type: Technical
Developer: Md. Sagar Ali
Summary: This Bkash integration provides three main APIs: Beneficiary Validation, Remit
Transfer, and Remit Status Check. Each endpoint reads the incoming data, saves it to a
specified file location, deserializes it into a model, and saves it to the database via the
corresponding method. Each operation logs success or failure, returning a structured
success response or an error code if it fails. These APIs enable efficient tracking and
management of Bkash transaction statuses, validation, and transfers within the system.
Success Response:
1|Pa ge
{
"responseCode": 200,
"responseDescription": "Success",
"conversionID": "123456",
"txnId": "TXN123456",
"approvalCode": "APRV123",
"processedTimestamp": "2024-10-24T12:34:56Z"
Flow:
Success Response:
"responseCode": 200,
"responseDescription": "Success",
"conversionID": "123456",
"txnId": "TXN123456",
"approvalCode": "APRV123",
"processedTimestamp": "2024-10-24T12:34:56Z"
"responseCode": 500,
"responseDescription": "Failed"
2|Pa ge
}
1. SaveValidation
• Return:
2. SaveTransfer
3. SaveStatus
• Return:
Each method:
• Starts a transaction.
• Calls a stored procedure.
• Logs the result.
• Commits or rolls back the transaction based on success or failure.
3|Pa ge
Bkash Internal Call Methods Summary
3.BkashRemitTransferInternalWithResponse(POST:/bkashRemitTransferInternalWithResponse)
• Purpose: Processes a Bkash remit transfer request and performs additional checks based on the
response.
• Key Steps:
▪ Similar to the previous method but includes additional logic for processing the
response based on the response code (3050 in this case).
▪ Calls a service method (CheckTransferRespone) to further process the
transaction based on conversationID.
4|Pa ge
2. CheckbkashRemitResultCallbackInternal (POST: /CheckbkashRemitResultCallbackInternal)
• Purpose: Checks the result of a Bkash remit transfer using the transaction ID.
• Key Steps:
1. CheckvalidateRespone
• Purpose: Fetches and returns the validation response for a Bkash transaction using the conversation
ID.
• Key Steps:
I. Executes a SQL query on the BKResponseHistories table to retrieve the validation response
(ResponseType = 1) for the given ConversationID.
II. If a valid response is found, deserializes the response into a ValidationResultModel and
returns it.
III. Implements retry logic with a delay between retries (up to 15 retries).
2. CheckTransferRespone
• Purpose: Fetches and returns the transfer response for a Bkash transaction using the conversation
ID.
• Key Steps:
I. Executes a SQL query on the BKResponseHistories table to retrieve the transfer response
(ResponseType = 2) for the given ConversationID.
II. If a valid response is found, deserializes the response into a RemitResultModel and returns
it.
III. Implements retry logic with a delay between retries (up to 15 retries).
5|Pa ge
3. CheckTransferResponeWithTnxId
• Purpose: Fetches and returns the transfer response for a Bkash transaction using the transaction ID.
• Key Steps:
I. Executes a SQL query on the BKResponseHistories table to retrieve the transfer response
(ResponseType = 2) for the given TxnId.
II. If a valid response is found, deserializes the response into a RemitResultModel and returns
it.
4. CheckStatusRespone
• Purpose: Fetches and returns the status query response for a Bkash transaction using the
conversation ID.
• Key Steps:
I. Executes a SQL query on the BKResponseHistories table to retrieve the status response
(ResponseType = 3) for the given ConversationID.
II. Ensures the response has not been marked as read (IsRead = 0).
III. Implements retry logic with a delay between retries (up to 15 retries).
IV. If a valid response is found, deserializes the response into a StatusQueryResultModel.
5. GetCnversionId
• Purpose: Fetches and returns the conversation ID for a given transaction ID.
• Key Steps:
• Table: BKResponseHistories
• Purpose: Logs Bkash transaction responses.
Columns
6|Pa ge
7. IsRead (smallint, Nullable) - Processed status.
8. ResponseTime (datetime) - Timestamp of response.
1. [GetBKConversationID]
Parameters:
Operations:
2. [InsertBKStatusResponse]
Parameters:
Operations:
3. [InsertBKTransferResponse]
Parameters:
Operations:
7|Pa ge
4. [InsertBKValidatonResponse]
Parameters:
Operations:
Each stored procedure performs specific data handling tasks, including retrieval or insertion into
BKResponseHistories with appropriate response types and error handling.
8|Pa ge