Skip to main content

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
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

planId
String

The plan ID (optional).

currency
String

Currency for the payment (e.g., “NGN”).

amount
String

Amount to be paid (nullable).

key
String

The API key for authenticating the transaction.

encryptionKey
String

This key is used to encrypt the card for secure transactions.

customerEmail
String

The email address of the customer.

customerName
String

The name of the customer (optional).

customerPhoneNumber
String

The phone number of the customer (optional).

customerId
String

The unique identifier for the customer (optional).

paymentDescription
String

Description of the payment (optional).

appLogo
String

App logo widget (optional).

appName
String

The name of the app (optional).

debugMode
bool

Enable 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

If 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
)