Standard solution

Last updated: 2019-4-4

System interaction flow

  1. Users start to check out at the cashier of the merchant.
  2. Users open Alipay app and then scan the QR code provided by the partner to visit the page provided by the partner.
  3. When the partner server processes the HTTP request, it discovers the UA is from Alipay Wallet (judging from the User-Agent value enclosed in the http request header). Then the partner server will redirect the user to the Alipay authorization page and specify the callback page URL in the request parameter.
  4. Alipay authorization page immediately (the user will not notice the page jumps) redirects the user to the partner’s callback page with the auth_code attached.
  5. With the auth code, the alipay.system.oauth.token API is called to obtain the Alipay user ID, and then records the Alipay user ID into the session. After that, the partner renders the payment page.
  6. The user enters the payment amount on the payment page and then submits it to the partner server to process.
  7. With the Alipay user ID stored in the session and other required parameters, the partner creates an order by calling the alipay.acquire.create API, and then send the returned Alipay trade number back to the H5 page.
  8. Within the H5 page, the partner calls jsapi:tradepay interface with the trade number using the Javascript language to request the payment.
  9. Alipay app prompts the user to confirm the order and pay. The user enters the password to complete the payment.
  10. After the payment succeeds, Alipay sends an asynchronous notification to the partner.
  11. In the meantime, Alipay notify the user of the successful payment by messages.

For the standard solution, a partner needs to complete the following steps:

  1. Apply for a developer account on Alipay open platform.
  2. Configure the web-based authorization callback page domain name on Alipay open platform.
  3. Construct an Alipay web-based authorization page URL.
  4. Provide the authorization callback page.
  5. Integrate the alipay.system.oauth.token.acquire API to obtain the Alipay user ID.
  6. Integrate the alipay.acquire.create API to create orders
  7. Integrate the jsapi:tradePay API to request payment.
  8. Receive the asynchronous notification of the payment result.

If you have any question, please contact us