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

# Android SDK

> Official Zentra library for Android applications

The Zentra Android SDK provides convenient access to the Zentra API from Android applications.

<Note>
  The checked-in Android wrapper currently exposes transfers, payments, virtual accounts, logs, and webhook verification. It does not currently expose cards or identity helpers in the package shown in this repo.
</Note>

```groovy theme={null}
// build.gradle (app)
dependencies {
    implementation 'io.zentra:zentra-android:1.0.0'
}
```

## Configuration

Create a client with your API key:

```kotlin theme={null}
import io.zentra.Zentra

val zentra = Zentra(BuildConfig.ZENTRA_API_KEY)
```

## Resources

Access resources through your `Zentra` instance:

* `zentra.transfers`: Bank transfers
* `zentra.payments`: Reviewed public charges, refunds, and saved payment tokens
* `zentra.virtualAccounts`: Virtual bank accounts
* `zentra.logs`: API request logs
* `zentra.webhooks`: Webhook signature verification

## Examples

### Create a Transfer

```kotlin theme={null}
import com.zentra.ApiException
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.launch

lifecycleScope.launch {
    try {
        val transfer = zentra.transfers.create(
            mapOf(
                "amount" to 500000L,
                "recipient_bank_code" to "058",
                "recipient_account_number" to "0123456789",
                "recipient_account_name" to "Vendor Settlement Account",
                "narration" to "Vendor payout",
                "reference" to "TRF_12345",
                "currency" to "NGN"
            )
        )
        Log.d("Zentra", "Queued: ${transfer.id}")
    } catch (e: ApiException) {
        Log.e("Zentra", "Error: ${e.message}")
    }
}
```

### Create Charge

```kotlin theme={null}
val charge = zentra.payments.charge(
    mapOf(
        "amount_minor" to 500000L, // ₦5,000.00
        "currency" to "NGN",
        "email" to "user@example.com",
        "reference" to "ORD_12345",
        "capture_mode" to "customer_action_required"
    ),
    idempotencyKey = "idem_charge_123"
)

val verified = zentra.payments.verify(charge.get("reference").asString)
Log.d("Zentra", "Status: ${verified["status"].asString}")
```

### Coroutines Support

The SDK supports Kotlin Coroutines for async operations:

```kotlin theme={null}
import kotlinx.coroutines.launch

lifecycleScope.launch {
    try {
        val accounts = zentra.virtualAccounts.list()
        Log.d("Zentra", "Accounts loaded: ${accounts.size}")
    } catch (e: ApiException) {
        Log.e("Zentra", "API error: ${e.message}")
    }
}
```

## Webhook Verification

The checked-in Android wrapper is API-first. Build your checkout UI in Compose or Views, then pair it with reviewed payment helpers and webhook verification:

```kotlin theme={null}
val valid = zentra.webhooks.verifySignature(payload, signature, webhookSecret)
if (!valid) {
    Log.e("Zentra", "Invalid webhook signature")
}
```

## Source Code

<CardGroup cols={2}>
  <Card title="GitHub Repo" icon="github" href="https://github.com/zentra/zentra-android">
    View source code
  </Card>

  <Card title="Maven Central" icon="android" href="https://search.maven.org/artifact/io.zentra/zentra-android">
    Download package
  </Card>
</CardGroup>
