Interaction process
Function process
Key steps in the payment process are explained below (take the payment process on Android platform as an example):
Step 4: Call payment API: this message is referring to the payment target PayTask provided by SDK, which sends order information after seller signs into payment method to call the Alipay Cashier interface - see "Request Parameters Description" for more details on order format.
Step 5: Payment request: Alipay mobile payment SDK sends payment request in accordance with the request parameters provided by the seller client.
Step 8: API returns payment result: payment API called by the seller client in step 4 returns a final payment result (a synchronous response) - see "Synchronous Response Parameters".
Step 12: send payment notification asynchronously: Alipay mobile payment server sends an asynchronous notification to seller's server (note: step 12 must happen after step 6, however not necessarily after step 7~11) - see "Server Asynchronous Notification Parameters".
Data interaction
1. Construct order data and sign
Merchant server side generates digital signature and a set of data for Alipay mobile payment SDK using the Alipay payment development API. For more details on the generation and configuration of signature-related public and private keys, please see Digital Signature.
2. Send request data
Send the constructed data set to Alipay mobile payment SDK.
3. Alipay mobile payment SDK process request data
Alipay mobile payment SDK will send payment request data, in accordance with the business and payment policy, to Alipay mobile payment server. The mobile payment server will conduct security check and other verifications after receiving the payment request data. If and only if all the verifications pass the security check, the payment request will be processed.
4. Return the processed result data
Once a transaction/payment has been processed, Alipay will feed the processed data back to the seller's client and server in two ways respectively.
1. On the client side, Alipay mobile payment SDK directly feeds the processed result data back to the seller's client on the mobile platform;
2. On the server side, Alipay mobile payment server initiates a notification using the page path set by the merchant/seller under the parameter notify_url (if the merchant/seller has not set the page path, this operation will not be conducted)
5. Processing of the returned result data by seller
After obtaining Alipay returned result data at the client's synchronous response receiving module or server asynchronous notification receiving module, seller can process the received data taking into account the seller's own business logic (e.g. order update, automatically top-up to the user's account, etc.). Synchronous response is used for displaying results only. Sellers must use asynchronous notification as a payment's final result.