Alipay+ DocsAlipay+ Docs

How to open the payment confirmation page with SDK

This chapter introduces how to open the payment confirmation page by using an SDK.

This solution is applicable when the merchant platform is an app and simplifies the logic of redirection processing at the app terminal.

In case the Alipay payment method is selected by the user, the SDK solution also optimizes the Alipay payment experience.

Note: The payment confirmation page is also known as the cashier page at the Mobile Payment Provider (MPP) side.

Integration modes

The SDK integration mode differs depending on how the merchant places orders to you. Generally speaking, your merchant may call your server or call your SDK to place orders.

Mode 1: Merchant calls ACQP server to place orders

The following figures illustrate the main workflow of opening the payment confirmation page when the merchant calls your server to place orders.

image

Figure 1. Call ACQP server to place order

The workflow contains the following steps:

  1. A user selects a payment method to initiate a payment. The merchant app sends the order information to the merchant server, which calls the ACQP server to place an order with the ACQP (Steps 1-3).
  2. The ACQP server checks the selected payment method. In case the Alipay+ payment method is selected, the ACQP server calls the pay API to place an order with Alipay+. Alipay+ then generates the payment data based on the order information and returns it to the ACQP server, which syncs the payment data to the merchant app (Steps 4-8).
  3. The merchant app calls the ACQP SDK with payment data to render the payment page (Step 9).
  4. The ACQP SDK extracts the payment data and calls the showPaymentSheet API provided by the Alipay+ SDK (Steps 10-11).
  5. The Alipay+ SDK processes the payment data and then directly redirects the user to the MPP side since only one specific payment method is selected in tile mode (Step 12).
    • If the Alipay payment method is selected, the Alipay+ SDK redirects the user to the Alipay cashier page, where the user confirms the payment. Then, the Alipay+ SDK notifies the ACQP SDK of the payment result in the callback event of the showPaymentSheet API. The ACQP SDK handles the callback event and returns the payment result to the merchant app (Steps 13-17).

Note: The event notification returned by the Alipay+ SDK only signals the termination of payment processing at the Alipay side. To obtain the final payment result from Alipay+, you need to integrate the inquiryPayment and notifyPayment APIs. For more information, see Handle the payment result.

    • If any other Alipay+ payment method is selected, the Alipay+ SDK redirects the user to the MPP's cashier page, where the user confirms the payment. The MPP then redirects the user back to the merchant app, which displays the payment result that is obtained by handling inquiryPayment and notifyPayment API calls (Steps 18-21).

Mode 2: Merchant calls ACQP SDK to place orders

The following figures illustrate the main workflow of opening the payment confirmation page when the merchant calls your own SDK to place orders.

image

Figure 2. Call ACQP SDK to place order

The workflow contains the following steps:

  1. A user selects a payment method to initiate a payment. The merchant app prepares the order information and calls the ACQP SDK to place an order with the ACQP. (Step 1-5)
  2. The ACQP SDK sends the order information to the ACQP server, which checks the selected payment method. In case the Alipay+ payment method is selected, the ACQP server calls the pay API to place an order with Alipay+. Alipay+ then generates the payment data based on the order information and returns it to the ACQP server, which syncs the payment data to the ACQP SDK (Steps 6-10).
  3. The ACQP SDK extracts the payment data and calls the showPaymentSheet API provided by the Alipay+ SDK (Steps 11-12).
  4. The Alipay+ SDK processes the payment data and then directly redirects the user to the MPP side since only one specific payment method is selected in tile mode (Step 13).
    • If the Alipay payment method is selected, the Alipay+ SDK redirects the user to the Alipay cashier page, where the user confirms the payment. Then, the Alipay+ SDK notifies the ACQP SDK of the payment result in the callback event of the showPaymentSheet API. The ACQP SDK handles the callback event and returns the payment result to the merchant app (Steps 14-18).

Note: The event notification returned by the Alipay+ SDK only signals the termination of payment processing at the Alipay side. To obtain the final payment result from Alipay+, you need to integrate the inquiryPayment and notifyPayment APIs. For more information, see Handle the payment result.

    • If any other Alipay+ payment method is selected, the Alipay+ SDK redirects the user to the MPP's cashier page, where the user confirms the payment. The MPP then redirects the user back to the merchant app, which displays the payment result that is obtained by handling inquiryPayment and notifyPayment API calls (Steps 19-22).

Integration methods

Depending on whether you have your own SDK, Alipay+ provides the following methods for you to implement the function of opening the payment confirmation page:

  • If you have your own SDK, you can integrate your own SDK with the Alipay+ client SDK and then provide the SDK to the merchant.
  • If you have no SDK, you can create a new SDK to wrap up the Alipay+ client SDK and then provide the SDK to the merchant.

It is recommended that you integrate Alipay+ and also other payment methods into the SDK that is provided to the merchant. This effectively saves the integration costs for the merchant as this allows the merchant to integrate only one SDK to use all payment options that you have to offer.

For more information about how to integrate the Android SDK provided by Alipay+, see Android SDK Quickstart.

For more information about how to integrate the iOS SDK provided by Alipay+, see iOS SDK Quickstart.

Next steps

Follow the instructions provided in Handle the redirection from the wallet of the Accept payments topic to handle the redirection from the wallet.