Last Updated: 23 August 2024 | Change Log

Android SDK


Set your views to take your customer's card details in your Android application.

Getting the SDK

To get our SDK, include the Gradle, Maven or Local AAR library configuration below.

implementation 'com.worldpay.access:access-checkout-android:1.2.0'

Local AAR library

If you're using the Local AAR library to get the SDK, copy the library file into your app/libs folder. Then add the flatDir repo to the project level build.gradle using the code in the Local AAR library example above.

You must also add the example below to your app level dependency list:

implementation (name:'access-checkout-android', ext:'aar')
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.31"

And here's a link to our Access Checkout Android SDK GitHub Repo

Set your views

When you create your checkout form, you must set the views that your customers use to enter their card details. You must use unique identifiers for your view configurations.

Here's an example of how you would set your view configurations.

<com.worldpay.access.checkout.views.PANLayout
            android:id="@+id/panView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            .../>
<com.worldpay.access.checkout.views.CardExpiryTextLayout
            android:id="@+id/cardExpiryText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            .../>
<com.worldpay.access.checkout.views.CardCVVText
            android:id="@+id/cardCVVText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="CVV"
            .../>

Import the SDK

After getting the SDK and setting your views, you must import the SDK into your project. Importing the SDK gives you access to all the classes, methods and functions you need to get a sessionState.

Here's an example of how you would import our SDK into your project.

import com.worldpay.access.checkout.AccessCheckoutClient

Reference your views

Once you've imported the SDK, you must reference your view configurations. You must use the unique view identifiers used when setting your view configurations.

Here's an example of how you would reference your view configurations.

val panView = findViewById<EditText>(R.id.pan)
val cardCVCText = findViewById<EditText>(R.id.cvc)
val cardExpiryText = findViewById<EditText>(R.id.expiryDate)
val submit = findViewById<Button>(R.id.submit_button)

Next steps


Create sessionState