Cancel
You can use the cancel API to cancel a transaction. The cancellation period is subject to the contract.
Before issuing a cancellation, you must be familiar with the following information:
- After a transaction is canceled before it is paid, a buyer cannot continue to pay.
- After a paid transaction is canceled, the payment amount is returned to a buyer's account.
- Commission fee: The commission fee is returned for the canceled transaction.
- Partial cancellation: Only a full cancellation is allowed.
- Cancellation period: The cancellation period depends on the payment method that a buyer used for a payment. See the following table for details:
Payment method | Cancellation period |
Indonesia-based payment methods, and JKOPay | Cancellation is not allowed. |
Thailand-based Online Banking, Mobile Banking APP, and Bank Transfer payment methods |
|
Card payment methods |
|
Mercado Pago (Brazil, Chile, Mexico, and Peru) | A transaction can be canceled for up to seven days after it is paid. |
Other payment methods | A paid transaction can be canceled before 00:15 on T+1 day (UTC+8:00). |
Table 1. Cancellation periods of payment methods
When to cancel a transaction
If you have business scenarios where there are transactions that need to be canceled (such as flash sales, hotel booking services, and ticket selling services). You can cancel a transaction by using the cancel API. After a transaction is canceled, the payment status is CANCELLED
. Even if a notification of a successful payment is received after the transaction is canceled, the payment status remains CANCELLED
. You can cancel a transaction in the following scenarios, and Antom handles the cancellation accordingly:
Scenario | Result |
The cancellation request is issued when the transaction is paid and within the cancellation period. | Full refund without charging the commission fee. |
The cancellation request is issued when the transaction is not paid and within the payment expiration period (14 minutes). | The transaction is canceled. Full refund without charging the commission fee if the transaction is paid after it is canceled. |
The cancellation request is issued when the transaction is paid and the payment result is still unknown after you receive the Antom asynchronous notification or use the inquiryPayment API. | The transaction is canceled. Full refund without charging the commission fee if the payment success notification of the canceled transaction is received. |
For card payments, the cancellation request is issued when the payment is authorized but is not captured. | The authorized transaction is canceled. |
Table 2. Handling of a cancellation request in different scenarios
Notes:
- You cannot cancel a transaction that has been refunded, including full and partial refunds. Attempting to cancel a refunded transaction results in the
PROCESS_FAIL
error code.- You cannot cancel a card payment after the payment funds are captured. However, you can initiate a refund for the payment.
- For the Mercado Pago payment method in Brazil, Chile, Mexico, and Peru, if you specify a payment expiration time that is earlier than seven days after the payment is initiated, you need to call the cancel API to close the transaction to prevent the buyer from further payments.
How to cancel a transaction
Step 1: Call the cancel API
You can cancel a transaction by using the cancel API. You must pass in one of the following parameters in your request:
Parameter | Required or not | Description |
paymentId | OPTIONAL | The unique identifier that Antom assigns to a transaction. |
paymentRequestId | OPTIONAL | The unique identifier that you assign to a request. |
Table 3. Details of the request parameters of the cancel API
Step 2: Obtain the cancellation result
After you call the cancel API, Antom is to synchronously return the cancellation result by result.resultStatus :
resultStatus | Explanation |
| The cancellation is successful. cancelTime indicates the time when the cancellation succeeds. |
| The cancellation failed. See Error codes of the cancel API for troubleshooting. |
| The cancellation is unknown. Resend the API request with the same value of paymentRequestId. paymentRequestId is the unique identifier of a cancellation, so resending the request by using the same value of the parameter cannot trigger multiple cancellations. Contact Antom Technical Support if the value of result.resultStatus is still |
Table 4. Explanation of result.resultStatus