Skip to main content

AliPay Integration

AliPay is a widely used third-party mobile and online payment platform in China. Integrating with LoginRadius allows users to log in using their AliPay identity. It enables the merchant to retrieve basic open information such as user ID, avatar, nickname, gender, province, and city.

Use-Cases

  • Apps targeting users in China who prefer logging in with AliPay

  • Merchants providing personalized services based on user profiles

  • Businesses simplify login and registration flows with familiar providers.

  • Organizations expanding into Chinese markets with localized identity options

Integration Guide

Alipay is a popular Chinese third-party mobile and online payment platform. Alipay users use their Alipay identity to log in to the merchant application securely, and the merchant can obtain basic open information (user ID, user avatar, nickname, gender, province, city, etc.) of Alipay users and provide corresponding open services.

AliPay App Configuration

This section provides information regarding AliPay account creation and verification. It also includes ID and bank details verification that you need to perform on AliPay’s official site.

This section explains how you can create an account on AliPay:

Step 1: If you have already created an account, ensure you have a verified AliPay account.

Step 2: To create a new account, you must configure the AliPay Login App on your computer.

Step 3: Click Registration on the AliPay site.

Step 4: Select your desired country in the Country/Region field.

Step 5: Enter your mobile phone number in the Phone Number field.

Step 6: Click the Get verification code button to receive a verification code via text message on your phone.

Step 7: Enter the SMS code you received on your phone in the SMS verification Code field.

Step 8: Click the Next button to proceed.

Configuration in LoginRadius Console

This section covers the configurations you must perform in the LoginRadius Console to implement AliPay as an OAuth Provider.

Step 1: Navigate to Authentication->Custom IDPs in the console.

Step 2: Click Add Custom IDP, select Custom OAuth Provider.

Step 3: In the Provider Name field, enter the unique name of the OAuth provider, as shown in the screen below.

Step 4: In the Extra Parameter In Redirect To Provider (Optional) field, enter any additional options (if any) supported by AliPay in addition to the default options.

Step 5: In the Customer Login Endpoint field, enter https://globalprod.alipay.com/login/global.htm.

Step 6: In the Access Token Endpoint field, enter https://open-na.alipay.com/api/alipay/intl/oauth/auth/applyToken.htm.

Step 7: In the Application Key field, enter your AliPay API Key.

Step 8: In the Application Secret field, enter your AliPay Secret.

Note: You can get more details about how to get AliPay’s API Key and Secret here.

Step 9: Application ID (Optional) – ID of your OAuth app.
Step 10: Scope – Enter the desired scopes that should be requested from the user during authentication.

Step 11: In the Response Type field, enter “code”.

Step 13: Customer Profile Endpoint – Enter the OAuth endpoint used to retrieve user profile data.

Step 14: In the Request Token HTTP Method field, enter the HTTP method of Request Token “GET”.

Step 15: In the Access Token Parameter Name For Api Access field, enter ”applyToken”.

  • Auto Lookup (Optional):
    Enable this to route users based on their email domain. Enter the domain name in the provided field.
    Note: Enabling AutoLookup removes the IdP from the Social Schema on your IDX page.

Step 16: The Header (optional) can be used for those providers that pass the Access Token in the header. Enter the Provider’s header name in Key and add any of the LoginRadius values from the following in the Value field:

  • #accesstoken#
  • #idtoken#
  • #oauthsignature#

Step 17: Pass the Query parameters (optional) from the AliPay Provider in key and value pairs (if AliPay supports query parameters).

Step 18: Data Mapping - Enter field mappings between AliPay fields and LoginRadius user profile properties.

  • Select Field(Dropdown): Select the LoginRadius field name you want to map to the respective AliPay field.
  • The profile Key: Enter the AliPay field name corresponding to the LoginRadius field name.

You can also map more fields (as per your requirements) by clicking on the Add Row button.

Notes:

  • The LoginRadius ‘ID’ field is the unique identifier for each profile attached to a LoginRadius customer account. Refer to the LoginRadius Data structure document for more details. The mapping of the LoginRadius 'ID' field (Loginradius field) is required for the OAuth Provider. A user will not be able to register/login if the value for this mapping is missing in the OAuth Provider.
  • To make this social login work, you need to map the only field, which is the LoginRadius ID field, to the AliPay unionid field (it’s mandatory).

Step 19: Now, click on the ADD button to add and save the settings.

Custom AliPay Social Login Icon

To customize the AliPay icon on your login screen, familiarize yourself with customizing your social provider icons here and follow the steps below:

  1. Refer to the Custom OAuth Provider Icon Setup Guide.

  2. Upload or link your preferred icon asset.

  3. Update the login widget code to include the AliPay provider and your custom icon.

Best Practices

  • Verify your AliPay developer account before starting the configuration.

  • Always map the unionid field to the LoginRadius ID.

  • Test login flows with both IDX pages and your app.

  • Protect your AliPay keys and secrets.

  • Use custom branding to enhance user trust and experience.