Return payment results
After the user makes a payment, Mobile Payment Provider (MPP) can return the payment result to Alipay+ by the following three ways:
- Return the payment result in the response of the pay API.
- Return the payment result in the asynchronous request of the notifyPayment API.
- Return the payment result in the response of the inquiryPayment API.
The following diagram illustrates all the possible combinations of the payment results that you (the MPP) might return in the three ways.
Figure 1. All the possible combinations of the payment results
If the payment reaches a final status (success or failure), make sure to keep the returned payment results consistent in the above three ways. However, there is one exception. If a payment succeeds (the parameters paymentResult.resultStatus is
S and paymentResult.resultCode is
SUCCESS) but then is successfully cancelled, you need to return the parameters paymentResult.resultStatus of
F and paymentResult.resultCode of
ORDER_IS_CLOSED to Alipay+ when Alipay+ calls the inquiryPayment API.
Note: In this scenario, a payment only fails when it is not successfully completed before the order closure time. Before that, the payment is being processed. Therefore, before the payment closure time, do not notify Alipay+ of the payment failure, nor respond to the payment result inquiry with payment failure.
It is required that you support both the notifyPayment API and the inquiryPayment API to ensure that Alipay+ receives the final payment result (success or failure). For example, when the payment result notification is not returned timely due to network or system problems, the inquiryPayment API can work as a complement to return the final payment result.
For how to respond to payment result inquiry through the inquiryPayment API, see Respond to payment inquiry.
For how to notify the payment result using the notifyPayment API, see Notify payment result.