Alipay+ DocsAlipay+ Docs

Handle a notification

Alipay+ provides some notification interfaces to asynchronously notify the Acquiring Service Provider of the processing result. The Acquiring Service Provider 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

authNotify

Used by Alipay+ to notify the Acquiring Service Provider of the authorization processing result, for example:

  • Creation result of the auth code after handling the prepare interface.
  • Creation result of the access token after handling the applyToken interface.
  • Cancelation result of the access token after handling the cancelToken interface.

notifyPayment

Used by Alipay+ to notify the Acquiring Service Provider of the payment processing result after handling the pay API request.

notifyRegistrationStatus

Used by Alipay+ to notify the Acquiring Service Provider 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 Acquiring Service Provider 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 Acquiring Service Provider can access the HTTP body accordingly.

Verify the signature

The notification request that Alipay+ sends to the Acquiring Service Provider 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 Acquiring Service Provider 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 Acquiring Service Provider 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 Acquiring Service Provider receives the notification, the Acquiring Service Provider 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 24h22m. After that, no notifications will be sent anymore.

More information

For more information about the notification interfaces, see: