# Online Payments

The Finix Android SDK lets you securely collect card and bank account details in your Android app using pre-built Jetpack Compose payment forms. Payment data is tokenized before it reaches your application, keeping sensitive card data out of your code and ensuring PCI compliance.

Tokens are created in Finix's vault and returned to your app. Use the token immediately to [create a Payment Instrument](/api/payment-instruments) via the Finix API.

Token Expiration
Tokens expire **30 minutes** after creation. Create a Payment Instrument as soon as you receive the token.

## Installing the Library

The library is available on [Maven Central](https://central.sonatype.com/artifact/com.finix/finix-android-payment-sheet). Add it to your `build.gradle`:


```groovy
buildscript {
    ext.finix_version = '0.4.1'
}

dependencies {
    implementation "com.finix:finix-android-payment-sheet:$finix_version"
}
```

Your project must be configured for Jetpack Compose:


```groovy
android {
    compileSdk 36
    defaultConfig {
        minSdk 24
        targetSdk 36
    }
    kotlinOptions {
        jvmTarget = 11
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion '1.5.15'
    }
}
```

## System Requirements

| Requirement | Value |
|  --- | --- |
| `minSdk` | 24 |
| `targetSdk` | 36 |
| `compileSdk` | 36 |
| Kotlin | 2.3.0 |
| Kotlin Compiler Extension | 1.5.15 |
| Material3 | 1.4.0 |
| JVM target | 11 |


Kotlin Compatibility
Consult the [Compose to Kotlin Compatibility Map](https://developer.android.com/jetpack/androidx/releases/compose-kotlin) if you need to match a specific Kotlin version.

## Quick Start

Render a payment sheet, handle the token response, and dismiss the sheet on any user action.


```kotlin
@Composable
fun CheckoutScreen() {
    val viewModel = viewModel<CheckOutViewModel>()
    val state = viewModel.state

    if (state.showPaymentSheet) {
        CompletePaymentSheetOutlined(
            applicationId = "YOUR_APPLICATION_ID",
            isSandbox = true, // set to false for production
            onDismiss = { viewModel.setShowPaymentSheet(false) },
            onNegativeClick = { viewModel.setShowPaymentSheet(false) },
            onPositiveClick = { token ->
                // token.id — use this to create a Payment Instrument via the Finix API
                viewModel.saveTokenResponse(token)
                viewModel.setShowPaymentSheet(false)
            }
        )
    }
}
```