Alipay+ DocsAlipay+ Docs

Cancel a payment

When Alipay+ does not receive the final payment result (success or failure) from the Mobile Payment Provider (MPP) within the payment expiry time, or when the Acquiring Service Provider wants to close the order before the payment expires, Alipay+ closes the transaction and calls the cancelPayment API to initiate the cancellation request to the MPP.

Note: The payment expiry time is set by the merchant or Alipay+ and is at most 1 minute for Auto Debit.

After receiving the cancellation request, regardless of the payment status (S, F, or U), you (the MPP) must ensure the cancellation is successful and refund funds to the user as soon as possible (if a refund is needed), except for timeout or system problems. This prevents user complaints when a transaction is successfully cancelled at the merchant side but no refund is received by the user due to failures at your side.

The following figure illustrates the flow of cancellation for a payment.


Figure 1. The flow of payment cancellation

The following list introduces more information about payment cancellation:

  • Cancellable period: The payment can only be cancelled within the agreed cancellable period, which is from the time when the transaction is initiated to 00:30 UTC+8 of T+1 day, regardless of the payment status. You need to allow the cancellation request for a payment within this time frame. The cancellable period is extended to T+1 day so that you can cancel payments for transactions that are initiated at around 24:00 UTC+8 of T day.
  • Cancellable amount: The payment can be cancelled only in the full amount.
  • Settlement and fee items: Cancelled transactions do not proceed to the settlement stage and are not included in the clearing and settlement files. No fees occur for cancelled transactions.

Processing logic

When cancelling a payment, you need to pay attention to the following items:

  • Idempotence: The parameter paymentRequestId is used for idempotence control. For cancellation requests with the same paymentRequestId and with the final payment status (S or F), you must return the unique result.
  • Payment status: For payments with different payment statuses, you must process the cancellation request as below to ensure a successful cancellation.
    • If the payment is successful, close the transaction and refund funds to the user.
    • If the payment is in process, close the transaction and ensure that no payment occurs for the transaction.
    • If the payment does not exist or fails, return cancellation success to Alipay+.
    • For a non-existent payment, if you receive a payment request that has the same paymentRequestId after the cancellation request, you must reject the payment request.
  • Return the result: After processing the refund request, you need to return the cancellation result to Alipay+. For how to return the result and information about the result codes, see More information in the API reference for cancelPayment.
  • Retry of Alipay+: When no response from the MPP is received, Alipay+ retries the cancellation request at incremental time intervals for about 2 hours.


The following sample shows the request and response of the cancelPayment API.

Request from Alipay+ to the MPP

Alipay+ sends the cancellation request.

 "acquirerId": "1022188000000000001",

The MPP returns a response that indicates a successful cancellation.

 "result": {

Related links

For more information about how to use the cancelPayment API (such as the field description), see cancelPayment.