Handle a notification
Alipay+ provides some notification interfaces to asynchronously notify the Acquiring Service Provider (ACQP) of the processing result. The ACQP needs to handle the notifications properly and returns a response to Alipay+.
Notification interfaces
The following table lists the notification interfaces that are provided for Auto Debit and how Alipay+ use them.
Notification interfaces | Usage scenarios |
Used by Alipay+ to notify the ACQP of the authorization processing result, for example:
| |
Used by Alipay+ to notify the ACQP of the payment processing result after handling the pay API request. | |
Used by Alipay+ to notify the ACQP of the merchant registration result after handling the registration API request. |
How to handle a notification
The following sections describe the common things that the ACQP needs to take into consideration when handling the notification.
Accept a notification
For a scenario that a notification is required, an HTTP POST is fired. The HTTP request is sent in the raw JSON, of which the Content-Type request header is specified as application/json
. Ensure that the ACQP can access the HTTP body accordingly.
Verify the signature
The notification request that Alipay+ sends to the ACQP is signed. The merchant needs to verify the signature to confirm whether the notification is sent from Alipay+. For how to validate a signature, see Validate a signature.
After the notification is delivered successfully, verify and process the information from the notification body.
Acknowledge the notification with a response
After receiving the notification, no matter what the content in the notification request body is, the ACQP must return a receipt acknowledgment message to Alipay+. Meanwhile, the response must also be signed.
Note: The result in the notification response is only used for acknowledgment that whether the ACQP has received the notification or not.
For example, for a notifyPayment request, no matter what the payment result is specified in the request, as long as the ACQP receives the notification, the ACQP needs to return a response where the value of result.resultStatus must be set to
S
.
Retry mechanism
After receiving the notification, respond with an HTTP status code of 200
and send an acknowledgement with result.resultStatus of S
to indicate that your server received and processed the call. If you respond with another status code or acknowledge with other values, Alipay+ takes the notification delivery as unsuccessful. Therefore, Alipay+ will retry to send the notification.
Notes:
- The interval between two adjacent times is: 2m, 10m, 10m, 1h, 2h, 6h, 15h
- The notifications will be sent 7 times at most, during a period of up to 24h 22m. After that, no notifications will be sent anymore.
More information
For more information about the notification interfaces, see: