Skip to main content

Introduction

The Spotflow Android SDK empowers developers to seamlessly integrate payment functionalities into their Android applications. It provides UI components and methods that allows you accept payment in your Android app.

Project Requirements

To integrate the Spotflow Android SDK into your project, ensure the following prerequisites are met:

  • Android Studio 4.1 or later
  • Android SDK API level 21 or higher while the minimum supported SDK version is 15
  • Android Gradle Plugin 7.2 and above
  • Gradle 7.1.3 and above
  • AndroidX
Beta Release

The Android SDK is currently a beta release. If you encounter any issues, kindly reach out to our support team at support@spotflow.one.

Installation

  1. Add the Spotflow SDK dependency to your app-level build.gradle file:
dependencies {
implementation 'com.spotflow:spotflow-android:latest_version'
}
  1. Add the Internet permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET" />
  1. Sync your project with Gradle files to download the SDK into your project. Upon installation, you gain access to the UI components and methods to accept seamless payment experiences in your Android app.

Parameters Required by the Library

ParameterTypeDescription
planIdStringThe plan ID (optional).
currencyStringCurrency for the payment (e.g., "NGN").
amountStringAmount to be paid (nullable).
keyStringThe API key for authenticating the transaction.
encryptionKeyStringThis key is used to encrypt the card for secure transactions.
customerEmailStringThe email address of the customer.
customerNameStringThe name of the customer (optional).
customerPhoneNumberStringThe phone number of the customer (optional).
customerIdStringThe unique identifier for the customer (optional).
paymentDescriptionStringDescription of the payment (optional).
appLogoStringApp logo widget (optional).
appNameStringThe name of the app (optional).
debugModeboolEnable or disable debug mode.

Avoid exposing your API keys in your application. Requests that require your API key should originate from a secure server environment.

Usage with Jetpack Compose

f you're using Jetpack Compose, call the PaymentUI composable function with the required parameters.

Integration Example

PaymentUI(
planID = "your_plan_id",
currency = "NGN",
amount = 100.0,
key = "your_key",
encryptionKey = "your_encryption_key",
customerEmail = "customer@example.com",
customerName = "John Doe",
customerPhoneNumber = "1234567890",
customerId = "customer_id",
paymentDescription = "Payment for services",
appLogo = R.drawable.your_logo,
appName = "Your App",
debugMode = true,
onSuccess = { transactionId, paymentData ->
// Handle successful payment
},
onFailure = { errorCode, errorMessage ->
// Handle payment failure
}
)

Usage by Launching an Activity

For apps not using Jetpack Compose, launch the payment activity directly.

Integration Example

SpotFlowPaymentActivity.start(
context = this,
merchantId = "your_merchant_id",
planID = "your_plan_id",
currency = "NGN",
amount = 100.0,
key = "your_key",
encryptionKey = "your_encryption_key",
customerEmail = "customer@example.com",
customerName = "John Doe",
customerPhoneNumber = "1234567890",
customerId = "customer_id",
paymentDescription = "Payment for services",
appLogo = R.drawable.your_logo,
appName = "Your App",
debugMode = true,
requestCode = PAYMENT_REQUEST_CODE
)

Help

Feel free to create issues and pull requests on GitHub if you need any help.