Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

Notifications

Learn about how to integrate notification APIs provided by Antom.

Features

The supported products and description of these notifications are shown in the following table:

Notification APIs

Checkout Payment

Auto Debit

Buyer-presented Mode Payment

Order Code Payment

Entry Code Payment

Description

notifyAuthorization

✔️

Sends the authorization result to you when the authorization succeeds or when the authorization cancellation succeeds. The parameter authorizationNotifyType indicates the type of the authorization notification.

  • AUTHCODE_CREATED: indicates a successful authorization.
  • TOKEN_CANCELED: indicates a canceled authorization.

notifyPayment

✔️

✔️

✔️

✔️

✔️

Sends the payment result to you when the payment processing reaches a final state of success or failure. The parameter result.resultStatus indicates the payment result.

  • S: indicates the payment is successful when notifyType is PAYMENT_RESULT; indicates the payment is being processed when notifyType is PAYMENT_PENDING.
  • F: indicates the payment is failed.

notifyCapture

✔️

Sends the capture result to you when the capture processing reaches a final state of success or failure. The parameter result.resultStatus indicates the capture result.

  • S: indicates a successful capture.
  • F: indicates a failed capture.

notifyDispute

✔️

✔️

Sends the dispute information to you. The parameter disputeNotificationType indicates the type of the dispute notification.

  • DISPUTE_CREATED: indicates a created dispute.
  • DISPUTE_JUDGED: indicates a judged dispute.

notifyRefund

✔️

✔️

Sends the refund result to you when the refund processing reaches a final state of success or failure. The parameter refundStatus indicates the refund result.

  • S: indicates a successful refund.
  • F: indicates a failed refund.

Table 1. Capabilities of notifications

Configure receiving address

You can configure the receiving address of each notification via an API or in Antom Dashboard. If you use both ways to specify the address, the URL configured in the API takes precedence.

Notification API

Configure in API

Configure in Antom Dashboard

notifyAuthorization

-

Go to Developer > Notification URL of Antom Dashboard to configure your notification URLs:

AD通知地址.jpg

Figure 1. Configure the receiving address in Antom Dashboard

notifyPayment

Specify the paymentNotifyUrl field in the pay API.

notifyCapture

Specify the paymentNotifyUrl field in the pay API.

notifyDispute

-

notifyRefund

Specify the refundNotifyUrl field in the refund API.

Table 2. Receiving address configuration

Process the notification

1. Verify the signature

The result notification from Antom is signed by Antom. It is recommended to verify the signature and check whether the notification is sent by Antom. You can verify the signature by yourself or by using Antom SDK.

To verify the signature by yourself, see Sign a request and validate the signature. To use Antom SDK, specify the values for the corresponding parameters in the SignatureTool.verify method provided in SDKs:

copy
boolean isSuccess = SignatureTool.verify(httpMethod, path, clientId, rspTimeStr, rspBody, signature, alipayPublicKey);

The value of signature is from the notification header. The following example shows a notification header:

copy
"Content-Type": "application/json", "Request-Time": "2019-07-12T12:08:56+05:30", "client-id": "T_111222333", "Signature": "algorithm=RSA256,keyVersion=1,signature=jTOHqknjk%2fnDjEn8lfg%2beNODdoh2eHGJV%2blvrKaDwP782WxJ7ro49giqUu23MUM8sFVVNvhg32qHS3sd4O6uf5kAVLqztqNOPJFZcjw141EVi1vrs%2bIB4vU0%2fK%2f8z2GyWUByh2lHOWFsp%2b5QKCclXp%2bjacYqWYUur5IVbuebR1LoD5IiJ7u7J9qYriFxodkxmIAJYJyJs7mks2FWHh2YePLj3K%2f4B65idy7RBKqY1NN1XcvqnbQmlfCH8CIv75bg%2fr9sGmPE5a%2bYgL8N9Q41buGwMSq1IcNsbceMbyPhw5Z5HnJ7tPz12fvdSi0cEicPikDthQ2EQFmtpntXcAc%2fHA%3d%3d"

2. Return a receipt acknowledgment message

After verifying the signature and confirming that the notification is from Antom, you need to return a receipt acknowledgment message to Antom to inform Antom of a successful receipt of the notification. No digital signature is required for the process of returning a receipt acknowledgment message.

The example below shows the header of the message you send to Antom:

copy
"Content-Type": "application/json", "response-time": "2019-07-12T12:08:56+05:30", "client-id": "T_111222333",

The example below shows the body of the message you send to Antom:

copy
{  "result": {     "resultCode":"SUCCESS",     "resultStatus":"S",     "resultMessage":"success"  } }

If no such message is returned to Antom due to operation or network issues, Antom will automatically resend the asynchronous notification within 24 hours for up to eight times or until the correct response is received. The sending intervals are as follows: 0s, 2 min, 10 min, 10 min, 1 h, 2 h, 6 h, and 15 h.

Note: Record the processed notifications received from Antom for a payment request, and properly handle the idempotency to avoid processing a single request multiple times.

Common Question

Q: Why I cannot receive the asynchronous notifications sometimes?

A: It might occur that the buyer completes the payment but you cannot receive the payment result. The possible reasons are:

  • When the payment is complete, the Antom server sends an asynchronous notification to inform the merchant of the corresponding payment result. However, for some wallets, asynchronous notifications will not be sent when the payment fails.
  • The asynchronous notification does not have a 100% delivery guarantee.

When this happens, you can call the inquiryPayment API to get the accurate payment result.