Alipay+ DocsAlipay+ Docs

Obtain payment results

Your server side can get the payment result by calling the inquiryPayment API and receiving the notifyPayment API request. For cashier payment, the inquiryPayment and notifyPayment APIs are both required to be integrated.

Alipay+ sends the notifyPayment API request to the ACQP when the user completes the payment. Also, the ACQP can call the inquiryPayment API to get the payment result from Alipay+. When the user completes the payment while the ACQP fails to receive the notifyPayment API request due to some network issues, the inquiryPayment API can take effect to ensure the final payment result is returned.

Collaboration between inquiryPayment and notifyPayment

The following figure illustrates how the inquiryPayment and notifyPayment APIs collaborate to ensure you get the payment result.

image.png

Before reading the information below, ensure that at least a table that includes orderNo and status is created in your database.

  • It is recommended that you can confirm whether the order status is init in the table before you send the inquiryPayment API request. You don't need to call the inquiryPayment API when you have got the final payment result via the notifyPayment API.
  • If the value of the paymentResult parameter in the response of the inquiryPayment API is SUCCESSor FAIL, your server side needs to update the order status in the table. Otherwise, your server side needs to retry the inquiryPayment API request to get the final payment result.
  • Your server side needs to return the response when receiving the notifyPayment API request from Alipay+, and then confirm whether the order status is init in the table before you update the order status. You don't need to update the order status when you have got the final payment result via the inquiryPayment API.

Integration requirements

It is required that you support both notifyPayment API and inquiryPayment API so that you are guaranteed to obtain the final payment result. For example, when you cannot receive the payment result notification due to network or system problems, the inquiryPayment API can work as a complement to ensure you get the final (success or failure) payment result.

Learn more about how to receive payment notifications through the notifyPayment API.

Learn more about how to inquire about payment results through the inquiryPayment API.