Use this interface to cancel a payment if the payment result is not returned for a long time, or to cancel a payment authorization after the authorization is completed.
The request result, which contains information related to the request result, such as status and error codes.
Result status. Possible values are:
- S: Indicates that the result status is successful.
- F: Indicates that the result status is failed.
- U: Indicates that the result status is unknown.
The actual execution completion time of the payment cancellation process, that is, the date and time when the payment cancellation succeeds. The value follows the ISO 8601 standard. This parameter is returned only when the cancellation succeeds.
To cancel the payment, you must provide one of the following parameters:
- paymentId: The original payment ID of the payment request to be cancelled, generated by Alipay when the merchant initiates the original payment.
- paymentRequestId: The original paymentRequestId of the payment request to be cancelled.
Responses for different cases
This section provides responses for different cases of failed cancellations.
1. The transaction required to be cancelled doesn't exist.
2. The transaction required to be cancelled was already refunded.
The transaction that has been refunded is not allowed to be cancelled. An error of PROCESS_FAIL is returned for this case.
3. The cancellation date exceeds the period during which the cancellation is supported.
If the cancellation date exceeds the expiration time, an error of CANCEL_WINDOW_EXCEED is returned for this case.
Result process logic
For different request results, different actions are to be performed. See the following list for details:
- If the value of result.resultStatus is S, the cancellation succeeds.
If the value of result.resultStatus is F, the cancellation fails. See the returned error code and determine further actions.
- If the value of result.resultStatus is U, the cancellation result is unknown. Use the same request parameters to retry the cancellation request.
- If no response is returned, use the same request parameters to retry the cancellation request.
|CANCEL_WINDOW_EXCEED||F||The cancellation date exceeds the period during which cancellation is supported. The period is agreed in the contract.|
|ORDER_NOT_EXIST||F||The order doesn't exist.|
|PROCESS_FAIL||F||A general business failure occurred. Don't retry.|
|PARAM_ILLEGAL||F||Illegal parameters exist. For example, a non-numeric input, or an invalid date.|
|KEY_NOT_FOUND||F||The key is not found.|
|REQUEST_TRAFFIC_EXCEED_LIMIT||U||The request traffic exceeds the limit.|
|API_INVALID||F||API is invalid or not active.|
|CLIENT_INVALID||F||The client is invalid.|
|SIGNATURE_INVALID||F||The signature is invalid.|
|METHOD_NOT_SUPPORTED||F||The server does not implement the requested HTTP method.|
|MEDIA_TYPE_NOT_ACCEPTABLE||F||The server does not implement the media type that is acceptable to the client.|
|UNKNOWN_EXCEPTION||U||An API calling is failed, which is caused by unknown reasons.|