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

# iOS SDK

> Official Zentra library for iOS and macOS applications

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

<Note>
  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.
</Note>

<CodeGroup>
  ```swift Swift Package Manager theme={null}
  dependencies: [
      .package(url: "https://github.com/zentra/zentra-ios.git", from: "1.0.0")
  ]
  ```

  ```ruby CocoaPods theme={null}
  pod 'Zentra', '~> 1.0'
  ```
</CodeGroup>

## Configuration

Initialize the SDK in your `AppDelegate` or `@main App`:

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

```swift theme={null}
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 Zentra 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:

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

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

  <Card title="CocoaPods" icon="apple" href="https://cocoapods.org/pods/Zentra">
    Download pod
  </Card>
</CardGroup>
