Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

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

Cancellation is not allowed.

Thailand-based Online Banking, Mobile Banking APP, Bank Transfer payment methods

  • The transaction can be canceled before the payment of a submitted order is completed.
  • A paid transaction cannot be canceled.

Card payment methods

  • A transaction can be canceled for up to seven days after it is paid.
  • A transaction whose payment is captured cannot be canceled.

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:

  • A refunded transaction cannot be canceled. Otherwise, the error code PROCESS_FAIL is returned.
  • For card payments, a transaction cannot be canceled but can be refunded after the payment is captured.

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

S

The cancellation is successful. cancelTime indicates the time when the cancellation succeeds.

F

The cancellation failed. See Error codes of the cancel API for troubleshooting.

U

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 U after three consecutive retries.

Table 4. Explanation of result.resultStatus