Client side integration with wallet
This document provides an integration guide for seamless redirection between merchants and wallets.
#Terms and definitions
The following terms and definitions are used in this document.
Person or institution that provides goods or services at a bilaterally agreed price.
Payment Method Provider (PMP)
Institution that processes payments on behalf of users.
Merchant or PMP HTML pages, which can be opened in mobile browsers.
Merchant or PMP app, which is an iOS App or an Android App.
URL Scheme allows users to open your app from other apps by tapping a custom URL, which is not recommended by iOS and Android any more. For more information about Scheme, see Defining a URL Scheme in iOS and Creating Deep Links to App Content in Android.
Table 1. Terms and definitions
To achieve a seamless redirection between merchants and wallets, merchants need to follow best practices for integration.
#Redirection from merchant to digital wallet
Three payment terminals on the merchant side that digital wallets might support are:
- WAP (Wireless Application Protocol)
The following table shows the payment terminals each digital wallet supports. Payment terminals that are currently not supported yet will be included in the future.
Auto Debit Payment
Table 2. Payment terminals supported by each digital wallet
Redirections from merchant to digital wallet side might involve the following terminal types:
- APP to APP: Merchant app to digital wallet app
(Note: If the user did not install the digital wallet app, an H5 page will be used instead.)
- APP to WAP: Merchant app to digital wallet H5 page (WAP)
(Note: When the user did not install the digital wallet app, this case is used.)
- WAP to WAP: Merchant WAP to digital wallet H5 page (WAP)
- WEB to WEB: Merchant website to digital wallet website:
(Note: The digital wallet website might require payment password for payment or provide a QR code for customers to scan and pay.)
#Best practice for seamless integration
Usually, interaction between merchant website and digital wallet website can be processed smoothly. However, interaction between the merchant and digital wallet app or H5 page can sometimes be unsuccessful due to different implementation methods of the merchant and digital wallet terminals. To ensure a smooth redirection process, follow these integration best practices.
#1. Use demo code and provide URL scheme
Due to various reasons, redirection failure often occurs in the process of evoking the authorization page or redirecting to the merchant side. The following actions need to be taken for the corresponding process:
- Evoke the authorization page: to avoid a failed redirection during this process, it is suggested to use Alipay demo code. For more information, see Demo code for launching a Scheme/H5-Scheme in Apps.
- Redirect to the merchant side: to avoid a failed redirection during this process, it is suggested to provide the URL scheme or allow the H5 page to evoke the app through URL scheme (H5-Scheme). For more information, see Recommended actions for merchant to take.
The following graphic shows an example of the two processes that often fail during a redirection between the merchant app and wallet app:
Figure 1. Redirection between the merchant app and wallet app
#Demo code for launching the Scheme/H5-Scheme in Apps
In the iOS App
The following code can be used to launch the Scheme/H5-Scheme in an iOS app:
The following sample shows a payment redirection URL:
In the Android App
The following code can be used to launch the Scheme/H5-Scheme in an Android app:
#Recommended actions for merchant or acquirer to take
The merchant needs to provide the URL scheme, an H5 redirection page, or a website redirection URL for different redirections between various terminals. The following table provides details about the recommended actions for merchants to take when processing redirections in different cases.
If you are an acquirer that serves to help merchants integrate with Alipay, you need to ensure:
- The merchant provides the URL scheme.
- The local app can be opened with the address of the scheme protocol in the H5 page.
Merchant terminal type
Recommended actions for merchants
The merchant terminal type is APP.
If the user did not install the digital wallet app, an H5 page is triggered. The H5 page is a login page or the digital wallet app download page.
The merchant terminal type is WAP.
The H5 page of the digital wallet is a login page or a digital wallet download page. To successfully redirect to the H5 page of the digital wallet, the merchant needs to provide an H5 redirection page with a URL.
The merchant terminal type is WEB.
The merchant needs to provide a website redirection URL.
The PC website can be a page that requires account and password to authorize or a page with QR code to be scanned for authorization.
Table 3. Recommended actions to take for a seamless integration
#2. Use sandbox to test
In sandbox, you can download a test digital wallet to simulate the process of evoking the cashier and redirecting to the merchant side. Test wallets are provided for iOS and Android systems respectively. The download links are as follows:
- Test wallet for the iOS system
- Test wallet for the Android system
Download address: Download
Note: Alipay provides test accounts for merchants to use in the test wallet. The following table shows the details about the provided test accounts:
Table 4. Test accounts