Skip to main content

Android SDK

The Zentra Android SDK provides convenient access to the Zentra API from Android applications.
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.
// build.gradle (app)
dependencies {
    implementation 'io.zentra:zentra-android:1.0.0'
}

Configuration

Create a client with your API key:
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

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

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:
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:
val valid = zentra.webhooks.verifySignature(payload, signature, webhookSecret)
if (!valid) {
    Log.e("Zentra", "Invalid webhook signature")
}

Source Code

GitHub Repo

View source code

Maven Central

Download package