Skip to main content

iOS SDK

The Zentra iOS SDK provides convenient access to the Zentra API from Swift applications.
The reviewed public HTTP surface for SDK integrations today is transfers, webhooks, virtual accounts, payments, cards, and tenant-enabled identity. Customers, wallets, and other higher-level helpers remain compatibility or draft surfaces unless your environment explicitly enables them.
dependencies: [
    .package(url: "https://github.com/zentra/zentra-ios.git", from: "1.0.0")
]

Configuration

Initialize the SDK in your AppDelegate or @main App:
import Zentra

@main
struct MyApp: App {
    init() {
        Zentra.configure(
            apiKey: ProcessInfo.processInfo.environment["ZENTRA_API_KEY"] ?? "",
            environment: .sandbox // or .live
        )
    }
    
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Resources

Access resources through the Zentra singleton:
  • Zentra.customers: Customer management
  • Zentra.payments: Payment processing
  • Zentra.transfers: Bank transfers
  • Zentra.virtualAccounts: Virtual bank accounts
  • Zentra.cards: Card issuing
  • Zentra.identity: KYC verification

Examples

Create Charge

let charge = try await Zentra.payments.charge(
    CreateChargeParams(
        amountMinor: 500000, // ₦5,000.00
        currency: "NGN",
        reference: "ORD_12345",
        email: "user@example.com",
        captureMode: .customerActionRequired
    )
)

let verified = try await Zentra.payments.verify(reference: charge.reference)
print(verified.status)

UI Integration

Keep the checkout UI in your app layer. The reviewed BaaS path is API-first: create charges or transfers from the SDK where appropriate, then use your backend and webhooks to confirm final payment state before you unlock value.

Error Handling

Handle errors with typed exceptions:
do {
    try await Zentra.payments.verify("INVALID_REF")
} catch ZentraError.invalidRequest(let message) {
    print("Bad request: \(message)")
} catch ZentraError.authentication {
    print("Check your API key")
} catch let error as ZentraError {
    print("API error: \(error.message)")
}

Source Code

GitHub Repo

View source code

CocoaPods

Download pod