notifySubscription
Alipay uses the notifySubscription interface to send the subscription result to the merchant when the subscription creation reaches a final state of success or failure.
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
subscriptionRequestId String REQUIRED
The unique ID assigned by a merchant to identify a subscription request.
More information about this field
- Maximum length: 64 characters
subscriptionId String REQUIRED
The unique ID assigned by Alipay to identify a subscription.
More information about this field
- Maximum length: 64 characters
subscriptionStatus String REQUIRED
The subscription status. Valid values are:
ACTIVE
: indicates that the subscription becomes active.TERMINATED
: indicates that the subscription is terminated.
More information about this field
- Maximum length: 32 characters
subscriptionNotificationType String REQUIRED
The notification type about the subscription.
CREATE
: indicates that the subscription was created.CHANGE
: indicates that the subscription was changed.CANCEL
: indicates that the subscription is canceled and the service is not provided after the current subscription period ends.TERMINATE
: indicates that the subscription is terminated and the service is not provided.
More information about this field
- Maximum length: 32 characters
subscriptionStartTime Datetime REQUIRED
The date and time when the subscription becomes active.
More information about this field
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
subscriptionEndTime Datetime REQUIRED
The date and time when the subscription ends.
More information about this field
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
periodRule PeriodRule object REQUIRED
The subscription period rule, used to define a subscription's billing period.
Response parameters
result Result object REQUIRED
A fixed value, which is sent to Alipay to acknowledge that the notification is received.
Request
Response
Result process logic
Send the following message with fixed values to Alipay after receiving the notification, to acknowledge that the notification from Alipay is received:
If no such message is returned to Alipay due to operation issues or network issues, Alipay automatically resends the notification up to eight times within 24 hours or until the correct response is received. The sending intervals are as follows: 0 sec, 2 min, 10 min, 10 min, 1 h, 2 h, 6 h, and 15 h.