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.
| Status | Description | Final | Required action |
|---|---|---|---|
| PENDING | The payment is being processed | No | No action required |
| SPECIFICATION | Some data is required for the purchase to be performed | No | Send 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 |
| REDIRECT | The customer has to be redirected to continue payment processing | No | Redirect the customer to the URL you received in the response from Amanpay |
| SUCCESS | The payment is completed successfully | Yes | Deliver goods or services to your customer |
| FAILED | The payment is declined | Yes | No action required |
| CANCELLED | The customer cancelled the payment before it was completed | Yes | No action required |
Request a purchase status
You can check the status of a purchase by sending the Amanpay payment platform a request as follows:
| URL | https://gateway.amanpay.io |
| API endpoint | /payments/purchases/status |
| HTTP request method | POST |
| Request body format | JSON |
| Header | Value | Description |
|---|---|---|
| Content-Type | application/json | HTTP header indicating the media type of the resource sent in the request body. |
| Authorization | calculated | Signature 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
merchantId | integer | Required | Your unique merchant ID that you got from Amanpay when integrating. |
paymentId | string | Required | Payment 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"
}