Android SDK (Kotlin)

Bynn ID Verification SDK for Android

Introduction

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

Verification Flow

Requirements

  • Android 7.0+ (API level 24)
  • Kotlin 1.8+
  • Android Studio Arctic Fox+
  • Jetpack Compose

Resources

Installation

Gradle

Add the following to your app-level build.gradle file:

dependencies {
    implementation 'com.bynn:verify-android:1.0.0'
}

Or add to your build.gradle.kts:

dependencies {
    implementation("com.bynn:verify-android: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
  • Jetpack Compose: Modern UI built with Jetpack Compose

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 AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />

Basic Implementation

import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.bynn.verify.VerificationSDK

@Composable
fun VerificationScreen() {
    var showVerification by remember { mutableStateOf(false) }
    
    Box(
        modifier = Modifier.fillMaxSize(),
        contentAlignment = Alignment.Center
    ) {
        if (showVerification) {
            val verificationFlow = VerificationSDK.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 = {
                    println("Verification completed successfully")
                    showVerification = false
                },
                onVerificationCancelled = {
                    println("Verification was cancelled")
                    showVerification = false
                },
                onVerificationError = { errorMessage ->
                    println("Verification error: $errorMessage")
                    showVerification = false
                }
            )
            
            verificationFlow()
        } else {
            Button(
                onClick = { showVerification = true }
            ) {
                Text("Start Verification")
            }
        }
    }
}

Activity Integration

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.MaterialTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MaterialTheme {
                VerificationScreen()
            }
        }
    }
}

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:

val ageVerificationFlow = VerificationSDK.shared.createVerificationFlow(
    apiKey = "YOUR_PUBLIC_API_KEY",
    kycLevel = "YOUR_KYC_LEVEL_ID",
    uniqueId = "550e8400-e29b-41d4-a716-446655440000", // Non-PII identifier
    ageVerification = true,
    showCompletionView = false
)
Age Verification

Configuration Options

API Reference

@Composable
fun createVerificationFlow(
    apiKey: String,
    kycLevel: String,
    firstName: String? = null,
    lastName: String? = null,
    uniqueId: String? = null,
    phoneNumber: String? = null,
    email: String? = null,
    ageVerification: Boolean = false,
    showCompletionView: Boolean,
    i18n: String? = null,
    organizationName: String = "",
    onVerificationCompleted: (() -> Unit)? = null,
    onVerificationCancelled: (() -> Unit)? = null,
    onVerificationError: ((String) -> Unit)? = null
): @Composable () -> Unit

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
ageVerificationBooleanEnable specialized age verification flow
showCompletionViewBooleanShow completion screen after verification
i18nString?Localization preference
organizationNameStringYour organization name for branding

Error Handling

The SDK provides comprehensive error handling through the onVerificationError callback:

onVerificationError = { errorMessage ->
    // Handle verification errors
    println("Verification error: $errorMessage")
}

ProGuard/R8 Configuration

If you're using code obfuscation, add these rules to your proguard-rules.pro:

# Bynn SDK
-keep class com.bynn.verify.** { *; }
-keep class com.amplifyframework.** { *; }

# Jetpack Compose
-keep class androidx.compose.** { *; }

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

Troubleshooting

Common Issues

Camera Permission Denied
Ensure your app requests camera permissions at runtime:

import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts

@Composable
fun RequestCameraPermission() {
    val launcher = rememberLauncherForActivityResult(
        ActivityResultContracts.RequestPermission()
    ) { isGranted ->
        if (isGranted) {
            // Permission granted, proceed with verification
        } else {
            // Handle permission denied
        }
    }
    
    LaunchedEffect(Unit) {
        launcher.launch(android.Manifest.permission.CAMERA)
    }
}

Network Issues
Ensure your app has internet permission and check your network connectivity.

Gradle Sync Issues
Make sure you're using compatible versions of Kotlin and Android Gradle Plugin.

Support

For questions or assistance, please contact us at:

License

This SDK is distributed under the Bynn Software License. See the LICENSE file for more information.