Cancel QR API
Method: POST
Path:https://amazonpay.amazon.in/v2/pay/cancel
Description: This API will be used to cancel the requested QR for a transaction. Once the cancel QR API
is called, QR should be removed from the Billing POS/ EDC display. Merchants to invoke cancel API with REFUND cancel intent for the following circumstances:
- Cashier initiated cancellation either by mistake or upon buyer’s request, before timer expires.
- EDC device level reversals – hardware, software issues leading to session expiry.
- Delay in IPN due to a network or server issue at PL end leading to session expiry.
Cancel API with REFUND should be invoked to cancel the transaction as well as to refund the amount for scenarios where a successful charge slip is not generated. For scenarios where a successful charge slip is generated and the amount needs to be refunded for some reasons, Refund API needs to be used.
Request Parameters
| Parameter Name | Data Type | Description | Mandatory | Constraints |
|---|---|---|---|---|
| merchantId | String | Merchant ID provided by Amazon | Yes | |
| chargeIdType | String | Order Type | Yes | Allowed value: "MerchantTxnId" |
| chargeId | String | Appropriate ID based on the type specified in the above field | Yes | |
| cancelIntent | Set | Process Cancellation and Initiate Refund | Yes | Possible values: "CANCEL_TOKEN" - Cancel payment token without refund "CANCEL_TOKEN","REFUND" - Cancel payment token with refund |
| cancellationReason | String | Specifies the reason for order cancellation | Yes | Possible values: |
| noteToCustomer | String | Cancellation Note to Customer | Yes |
Sample Request
{
"merchantId": "A2UOYLUXLC6NR3",
"chargeIdType": "MerchantTxnId",
"chargeId": "merchantOrder-12345",
"cancelIntent": ["CANCEL_TOKEN", "REFUND"],
"cancellationReason":"USER_CANCELLATION",
"noteToCustomer": "Customer chose payment by cash"
}
Response Parameters
| Parameter | Data Type | Description | Values |
|---|---|---|---|
| amount | String | Amount of the transaction id passed | - |
| currencyCode | String | Currency of transaction | 'INR' |
| amazonTransactionId | String | Amazon generated unique order Id for a transaction | - |
| transactionId | String | Unique id sent in the charge request. | - |
| status | String | Transaction status | Approved – For txn where charge is not created RefundAppliableButNotRequested - For txn where charge is created however refund is not requested. RefundAppliable - For txn where charge is created and refund is requested. Refer to cancelIntent and status table and response samples below |
| timeStamp | String | The timestamp in milliseconds as used at Amazon for generating the signature for the response. | - |
| createTime | String | When the request was created at our end. | - |
| updateTime | String | When the request was last updated and sent back. | - |
Sample Response
| HTTP Status Code | Description | Response Payload |
|---|---|---|
| 200 OK | Cancel QR request for a transaction for which charge was created, however, refund was not requested. In such a case, merchant is responsible for initiating refund. | |
| 200 OK | Cancel QR for a txn for which charge was created and refund was requested. Amazon will refund in such scenario. | |
| 200 OK | Cancel QR request for a transaction for which charge was not created. | |
| 400 | Error response for a cancel QR API request. | |
| 500 | Amazon Pay server issue, try again |
Common Errors
For more errors, refer to this.