Skip to content

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 Type Description Allowed values Is Nullable?
merchantId String Merchant ID provided by Amazon - No
chargeIdType String Type of order 'MerchantTxnId' No
chargeId String Appropriate id based on the type passed in the above field - No
cancelIntent Set Process cancellation and initiate refund based on value passed "CANCEL_TOKEN": Cancel payment token without refund

"CANCEL_TOKEN","REFUND": Cancel payment token with refund
No
cancellationReason String The reason for cancellation request 'SESSION_EXPIRED' – due to IPN delay or any other issues
'USER_CANCELLATION' – cancelled by cashier
'DEVICE_GENERATED_CANCELLATION' – For any device specific issues or reversal
No
noteToCustomer String Merchant notes to the customers for cancellation - No

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 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. -

Scenarios on cancelIntent and status

scenarios cancelIntent in Request Status in Response Refund
Txn is cancelled and charge took place CANCEL_TOKEN RefundApplicableButNotRequested No refunds initiated
Txn is cancelled and charge took place CANCEL_TOKEN, REFUND RefundApplicable Refund invoked by Amazon
Txn is cancelled with no charge CANCEL_TOKEN Approved No refunds initiated
Txn is cancelled with no charge CANCEL_TOKEN, REFUND Approved No refunds initiated

Sample Response

  • 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.
    Http status: 200 OK

    {
    "merchantId": "A28RUGPVUTQXU1",
    "chargeId": "ve7vdsd99sde7f",
    "amazonChargeId": "P04-0249917-0735882",
    "amount": 0.01,
    "currencyCode": "INR",
    "status": "RefundAppliableButNotRequested",
    "createTime": "2020-01-13T05:28:30.377Z",
    "updateTime": "2020-01-13T05:28:30.377Z"
    }
    
  • Cancel QR for a txn for which charge was created and refund was requested. Amazon will refund in such scenario.
    Http status: 200 OK

    {
        "merchantId": "A28RUGPVUTQXU1",
        "chargeId": "ve7vdsd99sde7f",
        "amazonChargeId": "P04-0249917-0735882",
        "amount": 0.01,
        "currencyCode": "INR",
        "status": "RefundAppliable",
        "createTime": "2020-01-13T05:28:30.377Z",
        "updateTime": "2020-01-13T05:28:30.377Z"
    }
    
  • Cancel QR request for a transaction for which charge was not created.
    Http status: 200 OK

    {
        "merchantId": "A28RUGPVUTQXU1",
        "chargeId": "ve7vdsd99sde7f",
        "amount": 0.01,
        "currencyCode": "INR",
        "status": "Approved",
    }
    
  • Error response for a cancel QR API request.
    Http status: 400 InvalidArguments

    {
        "code": "InvalidArguments",
        "message": " expiryTimeStamp field is mandatory, cannot be null or blank"
    }
    

Common Errors

For more errors, refer to this.