Skip to main content

Responses Callbacks

Response

Upon receiving your request, Amanpay returns a synchronous response (within a single HTTP session) to your system.

The response contains details of the payment you initiated in the payment platform and the current status of this payment. Note that responses to purchase and payout requests don't contain the final status of the payment as the final status for these operations is submitted to you in a callback.

When receiving responses from Amanpay, you should verify the signature in the Authorization header of a response to ensure authenticity.

Parameters that Amanpay sends in responses to your requests are described in the Parameters of responses and callbacks section below.

Here is an example of the data from a response to a purchase request.

{
"transactionId": "62861",
"paymentID": "payment_812",
"status": "REDIRECT",
"amount": 250.51,
"currency": "BDT",
"redirectUrl": "https://page.amanpay.io/checkout/04c881d8-8744-11f0-85ec",
"paymentType": "purchase"
}

Callback

A callback is an HTTP request that Amanpay sends to your system. Callbacks are sent to you using the POST method and are meant to notify you about the final status of purchases and payouts that you initiate in the payment platform.

Amanpay sends callbacks:

  • to the URL you provided the Amanpay support team with during integration
  • to the URL you submit in the notifyUrl parameter if you need to receive callbacks for a specific payment to an individual URL

When receiving callbacks from Amanpay, you should verify the signature in the Authorization header of a callback to ensure authenticity.

Parameters that Amanpay sends in callbacks to your system are described in the Parameters of responses and callbacks section below.

Here is an example of the data from a callback containing information about a successfully completed purchase.

{
"transactionId": "62861",
"paymentID": "payment_812",
"status": "SUCCESS",
"amount": 250.51,
"currency": "BDT",
"paymentType": "purchase",
"customerName": "Mark Cooper",
"customerAccountNumber": "185927571757184"
}

The following is an example of a callback sent if a payment has been declined.

{
"transactionId": "62861",
"paymentID": "payment_812",
"status": "FAILED",
"errorCode": "GENERAL_ERROR",
"errorMessage": "An unexpected error occurred while processing your request",
"amount": 250.51,
"currency": "BDT",
"paymentType": "purchase"
}

Parameters of responses and callbacks

The following table contains the parameters used in responses and callbacks from the Amanpay payment platform.

ParameterTypeAlways usedDescription
transactionIdstringYesPayment ID within the Amanpay payment platform.
operationIdstringYesOperation ID within the Amanpay payment platform.
paymentIDstringNoPayment ID within your system.
statusstringYesCurrent status of your payment.
errorCodestringNoError code. For the error codes that can be passed in this parameter, see the table below.
errorMessagestringNoDescription of the error. For the error messages that can be passed in this parameter, see the table below.
amountintegerYesPayment amount you passed in your request.
currencystringYesPayment currency you passed in your request.
paymentTypestringYesPayment method's type.
customerNamestringNoCustomer's full name.
customerAccountNumberstringNoCustomer's account number.
redirectUrlstringNoURL you should redirect your customer to. The parameter is submitted only in responses to purchase requests.

Listed below are the values that can be passed in the errorCode and errorMessage parameters.

Error codeError message
INVALID_CUSTOMER_ACCOUNTThe customer's phone number, email, or wallet ID is invalid or not found
CUSTOMER_NOT_VERIFIEDThe customer's account requires identity verification (KYC) to proceed
CUSTOMER_ACCOUNT_BLOCKEDThe customer's account is suspended or blocked
INSUFFICIENT_WALLET_BALANCEThe customer's wallet has insufficient balance to complete the transfer
MIN_TRANSFER_AMOUNT_VIOLATIONTransfer amount is below the minimum allowed threshold
MAX_TRANSFER_AMOUNT_VIOLATIONTransfer amount exceeds the maximum allowed per transaction
BLACKLISTED_CUSTOMERThe customer is on the internal blacklist
SELF_TRANSFER_NOT_ALLOWEDCannot transfer funds to the same wallet or linked account
CUSTOMER_COUNTRY_RESTRICTEDTransfers to customers in this country and from this country are not supported
TRANSACTION_NOT_FOUNDNo transfer found with the provided ID
TRANSFER_ALREADY_COMPLETEDThis transfer has already been successfully processed
TRANSFER_EXPIREDThe payment link or session has expired
INVALID_API_KEYAuthentication failed. API Key is invalid or expired
GENERAL_ERRORAn unexpected error occurred while processing your request
PAYMENT_CANCELLED_BY_CUSTOMERThe payment was cancelled by the customer before completion
PAYMENT_NOT_COMPLETED_BY_CUSTOMERThe payment was not completed by the customer
CUSTOMER_BANK_UNREACHABLEUnable to connect to the customer's bank. Please try again later