Skip to main content

Purchase statuses

Purchase statuses

When a purchase is being performed, it changes its statuses depending on different events occurring during its processing. It is necessary to consider the status of your purchase as it may require some actions from you for the purchase to be completed.

You can learn the status of your purchase:

  • by using the Amanpay Dashboard which is available at https://merchant.amanpay.io. Contact the Amanpay support team or your account manager to get access there
  • by checking responses and callbacks the payment platform sends to your system
  • by sending Amanpay a request to retrieve the purchase status. To learn how to create such a request, see the Request a purchase status section below

The following table contains the information about purchase statuses occurring when performing payments in Amanpay and the actions that you may need to perform upon these statuses.

StatusDescriptionFinalRequired action
PENDINGThe payment is being processedNoNo action required
SPECIFICATIONSome data is required for the purchase to be performedNoSend the necessary data to Amanpay in a request. For the information on how to build such a request, see the Submitting additional data for purchase section
REDIRECTThe customer has to be redirected to continue payment processingNoRedirect the customer to the URL you received in the response from Amanpay
SUCCESSThe payment is completed successfullyYesDeliver goods or services to your customer
FAILEDThe payment is declinedYesNo action required
CANCELLEDThe customer cancelled the payment before it was completedYesNo action required

Request a purchase status

You can check the status of a purchase by sending the Amanpay payment platform a request as follows:

URLhttps://gateway.amanpay.io
API endpoint/payments/purchases/status
HTTP request methodPOST
Request body formatJSON
HeaderValueDescription
Content-Typeapplication/jsonHTTP header indicating the media type of the resource sent in the request body.
AuthorizationcalculatedSignature string. For the information on how to generate the signature, see Signature generation and verification.


Parameters of the request to retrieve a purchase status:

The following table contains the parameters that have to be used in requests to retrieve a purchase status.

ParameterTypeRequiredDescription
merchantIdintegerRequiredYour unique merchant ID that you got from Amanpay when integrating.
paymentIdstringRequiredPayment ID unique within your system.

Here is an example of a request to retrieve a purchase status.

curl -X POST "https://gateway.amanpay.io/payments/purchases/status" \
-H "Content-Type: application/json" \
-H "Authorization: 58394ddf08b6851a30e1063758d20610c35282b4751c1c1beacbcd7e991e120135826ad877fb9fff64eb4b6402f4fc274ce7f5f1f03b93b028758ecde631e102" \
-d '{
"merchantId": 1758378,
"paymentId": "payment_812"
}'


Upon receiving your request, Amanpay sends a response to your system. The response contains the current status of your purchase.

The following are examples of the data from responses to requests to retrieve the status of purchase.

{
"transactionId": "62861",
"paymentID": "payment_812",
"status": "SUCCESS",
"amount": 250.51,
"currency": "BDT",
"paymentType": "purchase"
}
{
"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"
}