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,
implementation 'com.worldpay.access:access-checkout-android:1.2.0'
implementation 'com.worldpay.access:access-checkout-android:1.2.0'
<dependency>
<groupId>com.worldpay.access</groupId>
<artifactId>access-checkout-android</artifactId>
<version>1.2.0</version>
</dependency>
<dependency> <groupId>com.worldpay.access</groupId> <artifactId>access-checkout-android</artifactId> <version>1.2.0</version> </dependency>
allprojects {
repositories {
//...
flatDir {
dirs 'libs'
}
}
}
allprojects { repositories { //... flatDir { dirs 'libs' } } }
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"
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:
access-checkout-android
See More- Kotlin
- 8
- 2
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"
.../>
<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
import com.worldpay.access.checkout.AccessCheckoutClient
import com.worldpay.access.checkout.AccessCheckoutClient;
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
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)
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)
EditText panView = findViewById<EditText>(R.id.pan);
EditText cardCVCText = findViewById<EditText>(R.id.cvc);
EditText cardExpiryText = findViewById<EditText>(R.id.expiryDate);
Button submit = findViewById<Button>(R.id.submit_button);
EditText panView = findViewById<EditText>(R.id.pan); EditText cardCVCText = findViewById<EditText>(R.id.cvc); EditText cardExpiryText = findViewById<EditText>(R.id.expiryDate); Button submit = findViewById<Button>(R.id.submit_button);
Next steps