iOS SDK (Swift)

Bynn ID Verification SDK for iOS

Introduction

BynnIDVerification is a powerful SDK that enables seamless identity verification in your iOS applications. With our easy-to-integrate solution, you can quickly implement secure KYC (Know Your Customer) and age verification processes.

Verification Flow

Requirements

  • iOS 14.0+
  • Swift 5.5+
  • Xcode 13.0+

Resources

Installation

Swift Package Manager

Add the following URL to your Swift Package dependencies:

https://github.com/Bynn-Intelligence/Bynn-Mobile-SDK-iOS.git

Or add the dependency to your Package.swift:

dependencies: [
    .package(url: "https://github.com/Bynn-Intelligence/Bynn-Mobile-SDK-iOS.git", from: "1.0.0")
]

Key Features

  • Document Verification: Capture and verify government-issued IDs
  • Liveness Detection: Prevent fraud with advanced liveness checks
  • Age Verification: Specialized flows for age verification requirements
  • Customizable UI: Adapt the verification flow to match your app's design

Integration

Important: The uniqueId parameter should be a non-PII identifier (like a UUID) that you can use to identify the user in your system. This same identifier will be included in webhook responses to help you match verification results with your users.

Permissions

Add the following to your Info.plist:

<key>NSCameraUsageDescription</key>
<string>Camera access is required for document and selfie capture during verification</string>

Basic Implementation

import SwiftUI
import BynnIDVerification

struct ContentView: View {
    @State private var showVerification = false
    
    var body: some View {
        Button("Start Verification") {
            showVerification = true
        }
        .sheet(isPresented: $showVerification) {
            VerificationView()
        }
    }
}

struct VerificationView: View {
    @State private var verificationView: AnyView?
    
    var body: some View {
        VStack {
            if let view = verificationView {
                view
            } else {
                ProgressView("Loading verification flow...")
                    .onAppear {
                        Task {
                            await loadVerificationFlow()
                        }
                    }
            }
        }
    }
    
    func loadVerificationFlow() async {
        let view = await BynnVerification.shared.createVerificationFlow(
            apiKey: "YOUR_PUBLIC_API_KEY",
            kycLevel: "YOUR_KYC_LEVEL_ID",
            firstName: "John",
            lastName: "Doe",
            uniqueId: "550e8400-e29b-41d4-a716-446655440000", // Non-PII identifier
            phoneNumber: "+1234567890",
            email: "[email protected]",
            ageVerification: false,
            showCompletionView: true,
            onVerificationCompleted: {
                print("Verification completed successfully")
            },
            onVerificationCancelled: {
                print("Verification was cancelled")
            },
            onVerificationError: { errorMessage in
                print("Verification error: \(errorMessage)")
            }
        )
        
        verificationView = view
    }
}

Verification Flow

Our SDK provides a streamlined verification experience for your users:

1. Introduction Screen

Introduction

2. Document Scanning

Document Scan

3. Liveness Check

Liveness Detection

Age Verification

To implement our specialized age verification flow:

let ageVerificationView = await BynnVerification.shared.createVerificationFlow(
    apiKey: "YOUR_PUBLIC_API_KEY",
    kycLevel: "YOUR_KYC_LEVEL_ID",
    uniqueId: "550e8400-e29b-41d4-a716-446655440000", // Non-PII identifier
    ageVerification: true,
    showCompletionView: true
)
Age Verification

Configuration Options

API Reference

public func createVerificationFlow(
    apiKey: String,
    kycLevel: String,
    firstName: String?,
    lastName: String?,
    uniqueId: String?,
    phoneNumber: String?,
    email: String?,
    ageVerification: Bool = false,
    showCompletionView: Bool,
    onVerificationCompleted: (() -> Void)? = nil,
    onVerificationCancelled: (() -> Void)? = nil,
    onVerificationError: ((String) -> Void)? = nil
) async -> AnyView

Parameters

ParameterTypeDescription
apiKeyStringYour Bynn PUBLIC API key (available at https://dashboard.bynn.com/integration)
kycLevelStringVerification level from your Bynn dashboard (available at https://dashboard.bynn.com/setting/product/kyc)
firstNameString?User's first name
lastNameString?User's last name
uniqueIdString?Unique identifier for the user (non-PII, such as UUID) that will be included in webhooks
phoneNumberString?User's phone number
emailString?User's email address
ageVerificationBoolEnable specialized age verification flow
showCompletionViewBoolShow completion screen after verification

Error Handling

The SDK provides comprehensive error handling through the onVerificationError callback:

onVerificationError: { errorMessage in
    // Handle verification errors
    print("Verification error: \(errorMessage)")
}

Webhooks

BynnIDVerification supports webhooks to notify your backend systems about verification results. Webhooks include the uniqueId you provided during verification, allowing you to match results to specific users.

Configuration

Configure your webhooks in the Bynn Dashboard:

Event Types

  • decision.approved: Triggered when a verification is approved
  • decision.rejected: Triggered when a verification is rejected
  • decision.challenge: Triggered when a manual decision is required by your organization
  • aml.screening.match: Triggered when there's a match in AML screening