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.
Alipay+ Mobile Payment Partner (Alipay+ MPP)
An institution that processes payments on behalf of users.
The client-side terminal type is an HTML page that is opened via a mobile browser.
The client-side terminal type is a mobile application.
URL Scheme allows users to open a merchant's app from other apps by tapping a custom URL. However, this is not recommended by iOS and Android anymore. 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
Touch 'n Go
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, a WAP page will be used instead.)
- APP to WAP: Merchant app to digital wallet WAP page
(Note: When the user did not install the digital wallet app, this case is used.)
- WAP to WAP: Merchant WAP to digital wallet WAP page)
- 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
The interaction between the merchant and digital wallet's websites can usually be processed smoothly.
The interaction between the merchant and digital wallet's apps or WAP page, however, is more complicated due to the terminals' different implementation methods. 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 the Alipay demo code. For more information, see Demo code for launching a Scheme/WAP-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 mobile web page to evoke the app through URL scheme (WAP-Scheme). For more information, see Recommended actions for merchants 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/WAP-Scheme in Apps
In the iOS App
The following code can be used to launch the Scheme/WAP-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/WAP-Scheme in an Android app:
#Recommended actions for merchants or acquirers to take
The merchant needs to provide the URL scheme, a WAP 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 WAP page.
Merchant terminal type
Recommended actions for merchants
The merchant terminal type is APP.
If the user did not install the digital wallet app, a WAP page is triggered. The WAP page is a login page or the digital wallet app download page.
The merchant terminal type is WAP.
The WAP page of the digital wallet is a login page or a digital wallet download page. To successfully redirect to the WAP page of the digital wallet, the merchant needs to provide a WAP 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 an account and password to authorize, or a page with a 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