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

cancel

POST /v1/subscriptions/cancel

Use this 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 Antom 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.

Note: 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.

Note: 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  REQUIRED

Indicates whether this API is called successfully. If this API is successfully called, the subscription is canceled successfully. 

Show child parameters
API Explorer
Sample CodesRun in Sandbox

Request

URL
Case
Cancel a subscription
Request Body

Response

Response Body

Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

The interface is called successfully. 

PARAM_ILLEGALFThe 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_FAILFA general business failure occurred.

Do not retry. Human intervention is usually needed. It is recommended that you contact Antom Technical Support to troubleshoot the issue.  

UNKNOWN_EXCEPTIONUAn API call has failed, which is caused by unknown reasons.

Call the interface again to resolve the issue. If not resolved, contact Antom Technical Support.