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

      Payment Result Notification

      Alipay uses this interface to send the payment result to the merchant when the payment processing reaches a final state of success. Merchants promote merchant-side transactions based on the payment result.


      #Sample

      In the following example, an e-wallet user buys an 80 EUR item on a merchant website. Alipay sends the payment result to the merchant. The use of Payment Result Notification interface consists of the following steps:


      1. Alipay sends the payment result notification request to the merchant.

      The following example shows a successful payment result.

      copy
      {
          "notifyType": "PAYMENT_RESULT",
          "result": {
              "resultCode": "SUCCESS",
              "resultStatus": "S",
              "resultMessage": "success"
          },
          "paymentRequestId": "20200101234567890444",
          "paymentId": "20200101234567890132",
          "paymentAmount": {
              "value": "8000",
              "currency": "EUR"
          },
          "actualPaymentAmount": {
              "value": "8000",
              "currency": "EUR"
          },
          "paymentCreateTime": "2020-01-01T12:01:00+08:30",
          "paymentTime": "2020-01-01T12:01:01+08:30"
      }


      2. Merchant processes the payment notification and returns the processing result to Alipay. 
      By returning the following result to Alipay, the merchant indicates that the payment notification is successfully recepted by the merchant.

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


      #Structure

      #Request parameters

      No.

      Field

      Description

      1

      notifyType

      MANDATORY PaymentNotifyType

      Payment notification type. Valid values are:

      • PAYMENT_RESULT: indicates that the nofication is a payment result.
      • OFFLINE_PAYMENT_CODE: indicates that the nofication is an offline payment code.

      2

      result

      OPTIONAL Result

      The payment result

      3

      paymentRequestId

      MANDATORY String (64)

      The unique ID that is assigned by a merchant to identify a payment request. Special characters are not supported.

      4

      paymentId

      OPTIONAL String (64)

      The unique ID that is assigned by Alipay to identify a payment. 

      A one-to-one correspondence between paymentId and paymentRequestId exists.

      5

      paymentAmount

      MANDATORY Amount

      The payment amount that the merchant requests to receive in the order currency.

      6

      paymentCreateTime

      OPTIONAL Datetime

      The date and time when the payment is created, which follows the ISO 8601 standard.

      7

      paymentTime

      OPTIONAL Datetime

      The date and time when the payment reaches a final state of success or failure, which follows the ISO 8601 standard.

      8

      pspCustomerInfo

      OPTIONAL PspCustomerInfo

      Information about the customer of payment service provider (PSP).

      9

      grossSettlementAmount

      OPTIONAL Amount

      Total settlement amount, which equals to transaction amount multiplied by the value of settlementQuote. Note: This field is empty when the settlement currency is the same as the transaction currency.

      10

      settlementQuote

      OPTIONAL Quote

      The exchange rate between the settlement currency and transaction currency at the time of transaction, which is provided only in the locked-in rate case. Note: This field is empty when the settlement currency is the same as the transaction currency.


      #Response parameters

      No.

      Field

      Description

      1

      result

      MANDATORY Result

      The request result, which contains information related to the request result, such as status and error codes.


      #More information

      This section provides additional information about certain parameters. See the following parameters for details:

      • result (in the notification request sent by Alipay): 

      Payment result. If the value of result.resultStatus is S, then the payment succeeds.

      • paymentTime: 

      This field is returned only when the value of result.resultStatus is S.

      • paymentActionForm: 

      In the in-store payment scenario, paymentCode is passed in through this field, and merchants can display the code to the customer.


      #Result

      #Result process logic

      If the value of result.resultStatus is S, the payment result notification succeeds. Alipay doesn't take any further actions.


      #Result code

      This section helps you identify and resolve problems. See the following table for details: 

      No.resultCoderesultStatusresultMessage

      1

      SUCCESS

      S

      Success

      2

      UNKNOWN_EXCEPTION

      U

      An API calling is failed, which is caused by unknown reasons.