cancel
Use the cancel API to cancel or terminate a subscription. Canceling a subscription means that the service is not provided to the user after the current subscription period ends, and terminating a subscription means the service ceases immediately.
Structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Note: Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:
- If the data type of a field is Integer and its value is 20, set it as "20".
- If the data type of a field is Boolean and its value is true, set it as "true".
Request parameters
subscriptionId String
The unique ID assigned by Alipay to identify a subscription. The value of this parameter is the value of the same parameter that is returned by notifyPayment and notifySubscription for the original subscription.
Specify at least one of subscriptionId and subscriptionRequestId. A one-to-one correspondence between paymentId and paymentRequestId exists.
More information:
- Maximum length: 64 characters
subscriptionRequestId String
The unique ID assigned by a merchant to identify a subscription request.
Specify at least one of subscriptionId and subscriptionRequestId. A one-to-one correspondence between paymentId and paymentRequestId exists.
More information:
- Maximum length: 64 characters
cancellationType String REQUIRED
The cancellation type for the subscription. Valid values are:
CANCEL
: indicates canceling the subscription. The subscription service is not provided to the user after the current subscription period ends.TERMINATE
: indicates terminating the subscription. The subscription service is ceased immediately.
More information:
- Maximum length: 32 characters
Response parameters
result Result object REQUIRED
Indicates whether this API is called successfully. If this API is successfully called, the subscription is canceled successfully.
Request
Response
Result/Error codes
Code | Value | Message | Further action |
---|---|---|---|
SUCCESS | S | Success | The interface is called successfully. |
PARAM_ILLEGAL | F | The required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong. |
Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid. |
PROCESS_FAIL | F | A general business failure occurred. |
Do not retry. Human intervention is usually needed. It is recommended that you contact Alipay Technical Support to troubleshoot the issue. |
UNKNOWN_EXCEPTION | U | An API call has failed, which is caused by unknown reasons. |
Call the interface again to resolve the issue. If not resolved, contact Alipay Technical Support. |