Cancel a payment
The payment can be cancelled within the agreed cancellable period, which is from the time when the transaction is initiated to 00:15 UTC+8 of T+1 day, regardless of the payment status.
When to cancel a payment
The Acquiring Service Provider (ACQP) can call the cancelPayment API to cancel a payment in one of the following scenarios:
- The merchant/ACQP cannot receive the payment result from Alipay+ for a long time, or cannot obtain the payment result via the inquiryPayment API.
- The transaction is not completed after exceeding the maximum number of inquiries.
How to cancel a payment
The following figure illustrates the flow of payment cancellation initiated by the ACQP:

The payment cancellation initiated by the ACQP contains the following steps:
- The ACQP submits the cancellation request to Alipay+ (step 1).
- Alipay+ returns the cancellation result to the ACQP (step 1.1).
To cancel a payment, you can call the cancelPayment API. You can confirm whether the cancellation succeeds by the synchronous result returned by Alipay+.
Processing logic
When using the cancelPayment API, you need to take the following things into consideration:
- The cancel request only works on the payment and cannot be used on a refund.
- After you request a cancellation, you cannot change the order status to status other than cancelled. If the payment notification comes later than the cancellation response, the ACQP handles the payment result based on the cancellation response. If the cancellation fails, you need to retry the cancelPayment request until the cancellation succeeds.
- You might receive different results from Alipay+. Follow the instructions below to handle the result:
result.resultStatus | result.resultCode | Cancellation status | Further Actions |
S | SUCCESS | Cancellation succeeds | The merchant can reinitiate a payment request. |
F | Multiple possible values exist, such as
| Cancellation fails | Take actions according to the error message in result.resultCode.
|
U | Multiple possible values exist, such as
| Unknown | Use the same parameter to retry the cancelPayment request.
|
No result received after trying several times | Unknown | Contact connect_support@service.alipay.com. | |
Sample
The following sample shows the request and response when you call the cancelPayment API.
- Request from the ACQP to Alipay+
The ACQP can send the request with the parameter paymentRequestId or paymentId.
{
"paymentRequestId":"20200101234567897890"
}or
{
"paymentId":"20190608114010800100188820200350000"
}- Response from Alipay+ to the ACQP
The ACQP receives a response indicating a successful cancellation.
{
"acquirerId": "1111088000000000002",
"pspId":"1022172000000000001",
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"success"
}
}More information
For more information about how to use the cancelPayment API (such as the field description), see cancelPayment.