Getting Started

PointCheckout Integration Support

Android SDK


Getting started

These are the minimum required steps to use the PointCheckout SDK in your Android app. We assume that you are using Android Studio for your Android development. The minimum supported Android API level for the SDK is 16 (KitKat), however, setting the minimum Android API level to 26 (Pie) is recommended.

The SDK uses Google's SafetyNet API for security, setting minimum Android API to lower than 26 will prevent it from functioning.

Add the SDK to your project

  • Download the .aar (Android Archive Library) file from here 
  • Create libs directory and add the downloaded file to it.
  • Add the following to build.gradle
repositories {
   mavenCentral()
   flatDir {
       dirs 'libs'
   }
}
  • Add the dependency to app/build.gradle
dependencies {
    ...
    implementation(name:'pc-android-sdk', ext:'aar')
}

Add permissions

The PointCheckout SDK requires the following permissions. Please add them to your AndroidManifest.xml file if they are not already present:

<uses-permission android:name="android.permission.INTERNET"/>

Adding SafetyNet

Add Google's SafetyNet API to your app/build.gradle, follow this guide.

After these steps, rebuild your app and you are good to go!

Using the SDK

First, you will need a checkoutKey which can be obtained via PointCheckout's API.

Create PointCheckoutClient

Create an object of PointCheckoutClient:

Production environment with auto dismiss
PointCheckoutClient pcClient = new PointCheckoutClient();
Production environment without auto dismiss
PointCheckoutClient pcClient = new PointCheckoutClient(false);
Test environment without auto dismiss
PointCheckoutClient pcClient = new PointCheckoutClient(Environment.TEST, true);
ParameterDefaultDescription
EnvironmentEnvironment.PRODUCTIONSpecifies the environment of the app, use Environment.TEST for testing purposes.
autoDismisstrueCloses the modal on payment success or failure. Regardless of autoDismiss value, the onDismiss method of PointCheckoutEventListener will be called on payment success or failure.

Create a single instance of PointCheckoutClient and re-use that instance each time you want to checkout.

Initialize

Initialize PointCheckoutClient using:

PointCheckoutClient pcClient = new PointCheckoutClient();
pcClient.initialize(context);

Invoke initialize when the app starts because it needs 2-3 seconds. If the client is not initialized and checkout is performed, the client will call initialize internally before checking out.

Payment submit

To submit a payment call the pay method of the PointCheckoutClient:

pcClient.pay(context, checkoutKey, new PointCheckoutEventListener() {
  @Override
  public void onPaymentCancel() {
    // payment was cancelled
  }
  @Override
  public void onPaymentUpdate() {
    // check the status of the payment and act accordingly
  }
});

Calling the pay method will open a modal and the user will be able to log in and complete the payment.


Demo app

You can use our Demo app as an example of how to integrate our SDK on your application. you can access it from here. You can import the example app to Android Studio to see how the SDK can be used.



Last Updated  July 9, 2019