Alipay+ DocsAlipay+ Docs

Notify payment result

It is recommended to notify Alipay+ when a payment reaches a final status of success or failure. This guide explains how to use the notifyPayment API to send this notification.

The following figure shows the payment result notification flow of a transaction.

image.png

The process of notifying the payment result consists of the following steps:

  1. When the payment reaches the final status, the MPP server calls the notifyPlayment API to notify the Ant server.
  2. The Ant server returns an acknowledgment to the MPP server, confirming that the notification request has been received.

Step 1: Notify the payment result

When the payment achieves its final status, your server calls the notifyPayment API to notify the payment result to the Ant server.

Processing logic

When the payment processing reaches a final status of success or failure, you must send the payment result notification to Alipay+ and pay attention to the following rules.

  • If the payment succeeds, return a paymentResult.resultStatus of S and paymentResult.resultCode of SUCCESS.
  • If the payment fails, return a paymentResult.resultStatus of F and an error code that corresponds to a specific reason. For more information about the detailed reason, see Payment result codes.
  • If the payment is canceled, return a paymentResult.resultStatus of F and a paymentResult.resultCode of ORDER_IS_CLOSED.

Sample

Request from the MPP to Alipay+

The MPP sends a payment notification request that indicates a successful payment.

copy
{
 "paymentResult": {
    "resultCode":"SUCCESS",
    "resultStatus":"S",
    "resultMessage":"success"
 },
 "paymentRequestId":"20200101234567890132", 
 "paymentId":"202001012345678901322222", 
 "paymentTime": "2020-01-01T12:01:01+08:30",
 "paymentAmount":{
    "value":"100",
    "currency":"JPY"
 },
 "payToAmount":{
    "value":"1000",
    "currency":"KRW"
 }, 
 "customerId":"1234567"
}

Step 2: Receive acknowledgment

After receiving the payment notification from you, the Ant server returns an acknowledgment response to you. It is recommended that you are able to detect whether the Ant server fails to return the response with the parameter result.resultStatus of S and handle the response according to the instructions below.

result.resultStatus

result.resultCode

Notification status

Actions

S

SUCCESS

Successful

N/A

F

Multiple possible values exist, such as

ACCESS_DENIED,

KEY_NOT_FOUND, etc.

Failed

Take action based on the result code (specified in result.resultCode).

U

Multiple possible values exist, such as

UNKNOWN_EXCEPTION,

REQUEST_TRAFFIC_EXCEED_LIMIT, etc.

Unknown

Retry the request.

No result received

Unknown

Unknown

Retry the request.