Airwallex logo

Before you start

Step 1: Set up SDK

The Airwallex Android SDK is compatible with apps supporting Android API level 19 and above.

  1. Install the SDK To install the SDK, in your app-level build.gradle, add the following:
   dependencies {
        implementation 'com.airwallex:airwallex-core:2.0.3'
    }
  1. Add the cardinalcommerce Maven repo Additionally, add the following Maven repository and (non-sensitive) credentials to your app-level build.gralde:
repositories {
    maven {
        url "https://cardinalcommerce.bintray.com/android"
        credentials {
            username '[email protected]'
            password '99796fb351b999db8dced5b3f6ba6015efc862e7'
        }
    }
}

Step 2: Configuration and create payment intent

After setting up the SDK, you are required to configure your SDK. Before using Airwallex SDK to confirm payment intents and complete the payments, you shall create payment intents in your own server, to make sure you maintain information in your own system.

1. Configurate the SDK

We provide some parameters that can be used to debug the SDK, better to be called in Application

    Airwallex.initialize(
        AirwallexConfiguration.Builder()
            .enableLogging(true)                // Enable log in sdk, and don’t forogt to set to false when it is ready to release
            .setEnvironment(Environment.DEMO)   // You can change the environment to DEMO or PRODUCTION. It must be set to PRODUCTION when it is ready to release.
            .build()
    )

2. Create Payment Intent on your server

Before confirming the PaymentIntent, you must create a PaymentIntent on the server and pass it to the client.

Follow these steps to create a PaymentIntent on the Merchant’s server:

  1. To begin you will need to obtain an access token to allow you to reach all other API endpoints. Using your unique Client ID and API key (these can be generated within Account settings > API keys ) you can call the Authentication API endpoint. On success, an access token will be granted.
  2. Create customer(optional) allows you to save your customers’ details, attach payment methods so you can quickly retrieve the supported payment methods as your customer checks out on your shopping site. (/api/v1/pa/customers/create )
  3. Finally, you need to create a PaymentIntent object on your own server via /api/v1/pa/payment_intents/create and pass it to your client.
  4. In the response of each payment intent, you will be returned with client_secret, which you will need to store for later uses.

After creating the payment intent, you can use Airwallex SDK to confirm payment intent and enable the shopper to complete the payment with selected payment methods

Step 3: Choose integration option

  1. Airwallex API Integration . If you prefer to use your own payment UI, you can choose to integrate Airwallex Android SDK via API
  2. Airwallex Native UI integration . You can choose to use Airwallex Android SDK with our prebuilt UI page

Our demo application is available open source on Github and it will help you to better understand how to integrate Airwallex Android SDK in your Android App.