notifyPayment
Alipay uses notifyPayment to send the payment result of each subscription period to the merchant when the payment 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
result Result object REQUIRED
Details about the payment result, such as payment status, result code, and result message.
paymentId String REQUIRED
The unique ID assigned by Alipay to identify a payment for each subscription period.
More information about this field
- Maximum length: 64 characters
paymentAmount Amount object REQUIRED
The payment amount of each subscription period.
paymentCreateTime Datetime REQUIRED
The date and time when the payment of each subscription period is created.
More information about this field
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
paymentTime Datetime
The date and time when the payment of each subscription period reaches a final state of success.
This parameter is returned when the value of result.resultStatus is S
.
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
periodStartTime Datetime REQUIRED
The start date and time of the current subscription period.
More information about this field
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
periodEndTime Datetime REQUIRED
The end date and time of the current subscription period.
More information about this field
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
phaseNo String REQUIRED
Indicates the current phase of the subscription period. For example, if the subscription begins in May and operates on a monthly cycle for one year, then June represents the second phase, with phaseNo = "2".
More information about this field
- Maximum length: 64 characters
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.
Result/Error codes
Code | Value | Message | Further action |
---|---|---|---|
SUCCESS | S | Success |
The interface is called successfully. |
ACCESS_DENIED | F | Access is denied. |
Contact Alipay Technical Support for detailed reasons. |
INVALID_ACCESS_TOKEN | F | The access token is expired, revoked, or does not exist. |
Contact Alipay Technical Support for detailed reasons. |
CURRENCY_NOT_SUPPORT | F | The currency is not supported. |
Contact Alipay Technical Support for detailed reasons. |
ORDER_IS_CLOSED | F | The transaction is closed and cannot be paid again. |
Contact Alipay Technical Support for detailed reasons. |
PAYMENT_AMOUNT_EXCEED_LIMIT | F | The payment amount is greater than the maximum amount allowed by the contract or wallet. | Check whether the payment amount exceeds the limit or use a lower amount and try again. Contact Alipay technical support to know the specific limitation. |
PAYMENT_COUNT_EXCEED_LIMIT | F | The maximum number of payments exceeds the limit that is specified by the wallet. | Contact Alipay Technical Support to know the specific limitation. |
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. |
MERCHANT_BALANCE_NOT_ENOUGH | F | The merchant balance is not enough. |
Call the interface again after the merchant has sufficient balance. |
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. |
SYSTEM_ERROR | F | A system error occurred. |
Do not retry, and contact Alipay Technical Support for more details. |
USER_BALANCE_NOT_ENOUGH | F | The user's balance is insufficient for the payment. |
Contact Alipay Technical Support for detailed reasons. |
USER_STATUS_ABNORMAL | F | The user status is abnormal on the payment method side. |
Contact Alipay Technical Support to know the specific reasons. |