Alipay+ DocsAlipay+ Docs

Quickstart

This topic introduces how to quickly set up Alipay+ ACQP Android SDK.

Before you begin

Before you get started, ensure that the following requirements are met:

  • Install or update Android Studio to the latest version.
  • Use target API level 15 (ICE_CREAM_SANDWICH_MR1) or higher.
  • Use Gradle 4.1 or higher.
  • Use AndroidX.
  • Set up a physical device or use an emulator to run your app.

Get started

Step 1. Add SDK to your project

  1. Log on to Alipay+ Developer Center to download the SDK binaries as a package. You can also obtain the source code if you need to review or customize the SDK source code.
  2. Add the SDK binaries to the libs folder of your project.
  3. Add the following code to the build.gradle file of your module.
copy
dependencies {

    // Configure the SDK aar package
    compile (name: 'alipayplusclient', ext: 'aar')
    // Use version 1.3.0 or later
    implementation 'com.google.android.material:material:1.3.0'     
   
}
  1. (Optional) If you accept Alipay payments and want to optimize the Alipay payment experience, add the following line to import Alipay SDK:
copy
dependencies {
    // Add the following line
    api 'com.alipay.sdk:alipaysdk-android:+@aar'
    // ... Other dependencies
}

Note: In the Cashier Payment scenario, after you import Alipay SDK, the paymentRedirectUrl parameter in the pay API request does not take effect when the Alipay payment method is selected.

Step 2. Set up the SDK before using other APIs

Configure the following parameters to set up the SDK before you use other APIs provided by the SDK.

copy
IAPConfiguration configuration = new IAPConfiguration();
configuration.envType = "SANDBOX";
configuration.acquirerId = "XXX";
configuraiton.merchantId = "YYY";
configuration.language= "ZZZ";
AlipayPlusClient.setConfiguration(configuration);

Next steps

After you have integrated the Alipay+ ACQP Android SDK, you can move on to use the SDK in Cashier Payment. For more information, see Cashier Payment integration.