Alipay+ DocsAlipay+ Docs

Handle a notification

Alipay+ provides some notification APIs to asynchronously notify the Acquiring Service Provider (ACQP) of the processing result. The ACQP needs to handle the notifications properly and return a response to Alipay+.

Notification APIs

The following table lists the notification APIs that are provided for Auto Debit and how Alipay+ use them.

Notification APIs

Usage scenarios

authNotify

Used by Alipay+ to notify the ACQP of the authorization processing result, for example:

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

notifyPayment

Used by Alipay+ to notify the ACQP of the payment processing result after handling the pay request.

notifyRegistrationStatus

Used by Alipay+ to notify the ACQP of the merchant registration result after handling the registration 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

When a notification is required, Alipay+ sends an HTTP POST request to the ACQP. The HTTP request is sent in the raw JSON, of which the Content-Type request header is specified as application/json. The ACQP must 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 of 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. At this time, Alipay+ retries to send the notification. Such retries are conducted up to seven times at intervals of 2 minutes, 10 minutes, 10 minutes, 1 hour, 2 hours, 6 hours, and 15 hours.

Note: The retry mechanism is not supported when you test Alipay+ APIs in the sandbox environment.

More information

For more information about the notification APIs, see: