Integration
The following sections explain you can design your system and integrate with Alipay.
Calling APIs
The following sequence diagram illustrates the message flow and time order of the Wi-Fi connection solution:
Figure 1. Alipay Wi-Fi solution sequence flow
- The user connects with Alipay SSID.
- After the user connected with Alipay SSID, the mobile automatically requests the captive login page from Wi-Fi provider’s server. This page is displayed in the default browser on the user's mobile.
- In the meantime, the Wi-Fi provider needs to enable temporary Internet connection for the login process, at least for the Alipay app. This process can be performed by allowing Internet connection for a period of time or whitelisting Alipay’s IP addresses. Allowing Internet connection for a period time might cause confusion and users might abandon the login process, therefore, whitelisting Alipay’s IP address is preferred.
- The Wi-Fi provider returns the URL scheme, which can be used for invoking the authorization page in Alipay app.
- The user browser uses the returned URL scheme to invoke the Alipay app.
- The user can confirm to share personal data with the Wi-Fi provider in the Alipay app.
- After the user confirms to share personal data, Alipay server is called for an access code.
- Alipay browser appends the access code returned from Alipay server to the redirection URL and sends to the Wi-Fi provider’s server.
- The Wi-Fi provider calls the alipay.system.oauth.token interface to get the access token with the access code.
- Alipay server returns the access token to the Wi-Fi provider.
- With the access token, the Wi-Fi provide is able to get user data by using the alipay.user.info.share interface.
- At the end of the procedure, a page that shows the connection result is displayed to the user in Alipay app. Marketing information, vouchers, or even other Alipay applications can be presented in this page as well.
- Wi-Fi provider enables the Wi-Fi connection to the user so that the user can start to use the Wi-Fi network.
Note:
The Alipay interface alipay.user.info.share only provides basic information such as login name, or gender. If you need additional user data, contact Alipay technical support to get your needs reviewed by Alipay's security and legal teams.