> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spotflow.one/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

<Info>The Android SDK is currently a beta release. If you encounter any issues, kindly reach out to our support team at [support@spotflow.one](mailto:support@spotflow.one).</Info>

## Installation

1. Add the Spotflow SDK dependency to your app-level `build.gradle` file:

```yaml theme={null}
dependencies {
  implementation 'com.spotflow:spotflow-android:latest_version'
}
```

2. Add the Internet permission to your AndroidManifest.xml file:

```kotlin theme={null}
<uses-permission android:name="android.permission.INTERNET" />
```

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

| <p style={{fontWeight: '400'}}>planId<br /><span>`String`</span></p>               | <p style={{fontWeight: '400'}}>The plan ID (optional).</p>                                       |
| :--------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------- |
| <p style={{fontWeight: '400'}}>currency <br /> <span>`String`</span></p>           | <p style={{fontWeight: '400'}}>Currency for the payment (e.g., "NGN").</p>                       |
| <p style={{fontWeight: '400'}}>amount <br /> <span>`String`</span></p>             | <p style={{fontWeight: '400'}}>Amount to be paid (nullable).</p>                                 |
| <p style={{fontWeight: '400'}}>key <br /> <span>`String`</span></p>                | <p style={{fontWeight: '400'}}>The API key for authenticating the transaction.</p>               |
| <p style={{fontWeight: '400'}}>encryptionKey<br /> <span>`String`</span></p>       | <p style={{fontWeight: '400'}}>This key is used to encrypt the card for secure transactions.</p> |
| <p style={{fontWeight: '400'}}>customerEmail<br /> <span>`String`</span></p>       | <p style={{fontWeight: '400'}}>The email address of the customer.</p>                            |
| <p style={{fontWeight: '400'}}>customerName<br /> <span>`String`</span></p>        | <p style={{fontWeight: '400'}}>The name of the customer (optional).</p>                          |
| <p style={{fontWeight: '400'}}>customerPhoneNumber<br /> <span>`String`</span></p> | <p style={{fontWeight: '400'}}>The phone number of the customer (optional).</p>                  |
| <p style={{fontWeight: '400'}}>customerId<br /> <span>`String`</span></p>          | <p style={{fontWeight: '400'}}>The unique identifier for the customer (optional).</p>            |
| <p style={{fontWeight: '400'}}>paymentDescription<br /> <span>`String`</span></p>  | <p style={{fontWeight: '400'}}>Description of the payment (optional).</p>                        |
| <p style={{fontWeight: '400'}}>appLogo<br /> <span>`String`</span></p>             | <p style={{fontWeight: '400'}}>App logo widget (optional).</p>                                   |
| <p style={{fontWeight: '400'}}>appName<br /> <span>`String`</span></p>             | <p style={{fontWeight: '400'}}>The name of the app (optional).</p>                               |
| <p style={{fontWeight: '400'}}>debugMode<br /> <span>`bool`</span></p>             | <p style={{fontWeight: '400'}}>Enable or disable debug mode.</p>                                 |

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

```kotlin lines theme={null}
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

```kotlin lines theme={null}
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
)
```
