This guide helps developers create next-generation mobile experiences.
Android SDK overview
Accept payments through Network International in your Android app using the SDK’s prebuilt checkout flow and APIs.
Download the SDK and sample app from Android Payment SDK on GitHub.
Requirements
Supported Android version
Use a device or emulator that meets these requirements:
- Minimum API level: 19 (Android 4.4, KitKat)
- Compatibility: Follow the Android SDK compatibility guidelines.
Development environment
Prepare your development environment:
- Use Kotlin v1.3 or later with coroutine support, or a compatible Java-based Android project.
- Install Android Studio as your integrated development environment (IDE).
The SDK uses Kotlin coroutines for background and input/output operations to avoid conflicts with third-party dependencies.
Language and currency support
The SDK supports these languages and currencies:
- Languages: English and Arabic
- Currencies: AED (United Arab Emirates dirham) by default. Refer to the payment gateway for other supported currencies.
Get started
Use the Furniture Store sample app to explore the SDK, or import the SDK modules into your project.
Included modules
app module
app module-
Contains the sample merchant app
-
Depends on:
payment-sdkpayment-sdk-core- Android libraries: RxJava, Retrofit, OkHttp and Glide
payment-sdk module
payment-sdk module- Implements the Pay Page for card-based payments
- Collects card details, handles 3-D Secure (3DS) when required, and submits requests to the payment gateway
- Returns the result (success/failure) through an
Intentbundle
payment-sdk-core module
payment-sdk-core module- Provides shared interfaces and classes used by other SDK modules

Android SDK app modules
Download the SDK and sample app
Clone the SDK and sample project from GitHub:
git clone https://github.com/network-international/payment-sdk-android.gitAlternatively, download the ZIP if you prefer not to use Git.
After downloading:
- Open the project in Android Studio.
- Allow Gradle to sync and download dependencies.
- Run the Furniture Store sample app on your emulator or physical device.
Run the app on Android 4.4 (API level 19) or later.
Run the sample app and merchant server
Use the sample app and Sample Merchant Server to test the SDK locally.
The sample merchant server is available in PHP and JavaScript (Node.js) versions.
Step 1: Import the sample merchant app
Import the project:
-
Open Android Studio.

Open a project in Android Studio
-
Select Open an existing project from the welcome screen.
-
Browse to the folder where you cloned the SDK (
payment-sdk-android). -
Select the root directory.
-
Select Open.
-
Allow Gradle to sync and download any missing dependencies.
-
Run the app in an emulator or on a physical device after the project loads.
Step 2: Run the sample merchant server
The included Node.js sample merchant server simulates a backend environment. It communicates with the payment gateway and serves mock payment data.
Prerequisites
Install Node.js before configuring the server.
Configuration
Configure the sample server:
- Install the
dotenvpackage:npm install dotenv - Open the
app.jsfile. - Add the following line to the file:
require('dotenv').config(); - Create a
.envfile with the following settings:API_KEY=YOUR_API_KEY IDENTITY_API_URL=YOUR_IDENTITY_API_URL GATEWAY_API_URL=YOUR_GATEWAY_API_URL PORT=3000 REALM=YOUR_REALM - Replace the placeholders using the values provided in the N-Genius Online portal.
Replace the placeholders as follows:
YOUR_API_KEY: Your API key.YOUR_IDENTITY_API_URL: Your full identity API URL, includinghttps://.YOUR_GATEWAY_API_URL: Your full payment gateway API URL, includinghttps://.YOUR_REALM: Your realm.
Use the documented sandbox URLs for testing. Read Create an order for credential and endpoint guidance.
Start the server
Open a terminal in the project directory and run:
node app.jsOpen the local server’s health URL in your browser:
http://localhost:3000/healthThe browser displays the sample server’s working status when the server is running. If the server does not load, check the terminal logs for errors.

Sample server working status
Step 3: Connect the app to the server
Configure the sample app’s server address:
- Open the app module’s
build.gradlefile. - Set
BASE_URLusingbuildConfigFieldto the merchant server address.
Use the following configuration for the local server in an Android emulator:
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "String", "BASE_URL", "\"http://10.0.2.2:3000/\""
}
release {
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "String", "BASE_URL", "\"http://10.0.2.2:3000/\""
}For physical devices, connect the device and your development machine to the same Wi-Fi network.
Step 4: Run the sample app
Select Run in Android Studio to launch the app.
The sample app opens with an option to make a payment.

Demo Store
Before testing payments, configure the sample app:
-
Tap the gear icon in the app’s top right corner.
-
Tap + next to Merchant Attributes.
-
Enter a key-value pair.
-
Tap Add.

Merchant attributes
-
Tap + next to Environments.
-
Enter a name, API key, outlet reference and realm from the portal.
-
Tap Add.

Add an environment
-
Tap the back button to return to the home screen.
For credential details, read Create an order.
Step 5: Make a test payment
Use a sandbox test card to test payments:
- Select items from the home screen.
- Tap Pay.

Select items for payment
Enter the test card number with any name, expiry date and card verification value (CVV) on the payment screen. Tap Make Payment.

Enter card details
For transactions requiring a 3DS challenge, enter the one-time passcode (OTP) on the challenge screen. Tap Submit. Frictionless transactions skip this screen.

3DS challenge
The app displays a "Payment Success" message when the payment succeeds.

Successful payment
SDK payment flow
When you tap PAY WITH CARD in the sample app, the app requests a payment session from the sample merchant server.
The app then hands control to the Payment SDK, which performs these actions:
- Displays a secure card entry form
- Handles 3DS authentication when required
- Returns a success or failure response to the app
Payment API reference
Configure the Payment SDK to initiate card payments and handle payment gateway results in your Android app.
SDK modules
Import only the SDK components your integration uses.
Required modules
At minimum, import the following Gradle modules:
payment-sdk
payment-sdk-coreOptional: Additional modules
Import additional modules only for payment methods your integration uses. This reduces your Android application package (APK) size and build time.
PaymentClient
PaymentClientThe PaymentClient class is your main entry point to initiate and manage payment flows from within your app.
Initialisation
Instantiate PaymentClient using an Activity, not a Context. The SDK returns payment results through onActivityResult().
class PaymentClient(private val context: Activity)
Legacy activity resultsAndroid’s
onActivityResultpattern is legacy. For new saved card integrations, use the launcher-based approach.
For usage examples, refer to the Furniture Store sample app.
Deprecated saved card flowSaved card flows using
PaymentClientandonActivityResultare deprecated. Do not use them for new integrations.Use the launcher-based saved card flow.
Amount representation
The SDK represents amounts using BigDecimal in major currency units.
Each currency has an exponent (the number of decimal places for its minor unit). AED uses an exponent of 2, with 100 fils per dirham:
| Currency | Exponent | Format | SDK amount example | Equivalent minor units |
|---|---|---|---|---|
| AED | 2 | major.minor | AED 0.00 as 0.00 | 0 fils |
Card payments
Initiate card payments and handle their results using the SDK.
Payment flow
A card payment follows this sequence:
- The merchant app requests a payment session from your merchant server.
- The merchant server returns payment session details.
- The app calls
launchCardPayment()with the required parameters. - The SDK presents a card input form and handles 3DS when required.
- The payment gateway processes the payment and returns a result.
- The SDK returns the result to the merchant app through
onActivityResult().
Launch a card payment
Use the following method to launch a card payment:
Saved card paymentsDo not use the deprecated
PaymentClientandonActivityResultapproach for saved card payments.Use the launcher-based saved card flow.
paymentClient.launchCardPayment(
request: CardPaymentRequest,
requestCode: Int
)This method launches an activity to collect card details and manage the 3DS flow. When payment completes, the SDK triggers onActivityResult() in your calling activity.
Saved card payments using the launcher
Launch saved card payments with the launcher pattern and receive results through a callback.
1. Initialise the launcher
private val savedCardPaymentLauncher = SavedCardPaymentLauncher(this) {
viewModel.onPaymentResult(it)
}2. Trigger a saved card payment
savedCardPaymentLauncher.launch(
SavedCardPaymentRequest.Builder()
.payPageUrl(payPageUrl)
.gatewayAuthorizationUrl(authorizationUrl)
.build()
)3. Handle the payment result
fun onPaymentResult(result: PaymentsResult) {
when (result) {
PaymentsResult.Success -> saveCardFromOrder(orderReference)
PaymentsResult.Authorised -> { /* handle authorised state */ }
PaymentsResult.Cancelled -> { /* handle cancellation */ }
is PaymentsResult.Failed -> { /* handle failure using result.error */ }
}
}Use this launcher-based approach for new saved card integrations. It avoids the deprecated PaymentClient and onActivityResult pattern.
Handle the result
Example of handling the card payment result:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == CARD_PAYMENT_REQUEST_CODE) {
when (resultCode) {
Activity.RESULT_OK -> onCardPaymentResponse(
CardPaymentData.getFromIntent(data!!)
)
Activity.RESULT_CANCELED -> onCardPaymentCancelled()
}
}
}If the customer cancels the payment, for example by pressing Back, the SDK returns RESULT_CANCELED.
Result codes
After the SDK returns control, evaluate the outcome using CardPaymentData:
override fun onCardPaymentResponse(data: CardPaymentData) {
when (data.code) {
CardPaymentData.STATUS_PAYMENT_AUTHORIZED,
CardPaymentData.STATUS_PAYMENT_PURCHASED,
CardPaymentData.STATUS_PAYMENT_CAPTURED -> {
view.showOrderSuccessful()
}
CardPaymentData.STATUS_PAYMENT_FAILED -> {
view.showError("Payment failed")
}
CardPaymentData.STATUS_GENERIC_ERROR -> {
view.showError("Generic error (${data.reason})")
}
else -> IllegalArgumentException("Unknown payment response (${data.reason})")
}
}Result code descriptions
| Status code | Description |
|---|---|
STATUS_PAYMENT_CAPTURED | The payment gateway captured the payment (SALE action). |
STATUS_PAYMENT_PURCHASED | The payment succeeded (PURCHASE action). |
STATUS_PAYMENT_AUTHORIZED | The payment gateway authorised the payment (AUTH action). |
STATUS_PAYMENT_FAILED | The payment failed at the payment gateway. |
STATUS_GENERIC_ERROR | A client-side error occurred, such as a network issue or unexpected exception. |
Read Get a result from an activity in the Android documentation for callback details.
Create a card payment request
Before launching a card payment, create a CardPaymentRequest object using the CardPaymentRequest.Builder class.
The builder requires one parameter:
gatewayUrl: The URL your merchant server provides after initiating order creation. Use this URL to build the card payment request.
Currency units for order creation
The SDK uses BigDecimal in major units. During order creation, send the payment gateway an integer representing the amount in the currency’s minor unit.
Convert major units to minor units as follows:
- AED 1.00 →
100fils - AED 3.99 →
399fils - USD 1.00 →
100cents
Refer to the PaymentOrderApiInteractor class in the sample merchant app for more information.
Configure project dependencies
Import the SDK modules into your Android Studio project:
- Right-click your main app module.
- Select New > Import Module....
- Select the
payment-sdkfolder. - Select Open.
- Right-click your main app module.
- Select Open Module Settings.
- Go to Project Structure > Dependencies.
- Select +.
- Select Module Dependency.
- Select all the SDK modules in the list. Hold Shift to select multiple modules.
- Select OK.
The payment-sdk module imports its additional dependencies automatically. After adding the modules, your project is ready to use the SDK.
Use executeThreeDS()
executeThreeDS()
Deprecated saved card flowSaved card flows that use
PaymentClientandonActivityResultare deprecated, including flows that combine 3DS handling with legacy activity results.Do not use these flows for new integrations. Use the launcher-based saved card flow.
Use executeThreeDS() to trigger the EMV 3-D Secure flow for tokenised payments, such as saved cards. This authenticates the cardholder.
paymentClient.executeThreeDS(
paymentResponse: PaymentResponse,
requestCode: Int
)The method accepts these parameters:
paymentResponse: APaymentResponsecontaining the full JSON response from the N-Genius saved card payment API.requestCode: AnIntthat distinguishes this callback inonActivityResult().
Optional: Customise SDK colours
Override colour resources in your project’s colors.xml file to match your brand.
Example:
<color name="sdk_primary_color">#FF6200EE</color>
<color name="sdk_secondary_color">#FF03DAC5</color>Refer to the SDK theming documentation or contact your account team for the full list of customisable keys.
Read the webhooks guide for webhook integration details.
Latest SDK updates
Android SDK v7.0.0 includes these updates:
- Unified Payment Page support
- AANI QR code payments
- Click to Pay enhancements
- SDK theming and localisation updates
- Payment user interface updates
- Testing and environment management enhancements

