videokyc_flutter 1.0.1
videokyc_flutter: ^1.0.1 copied to clipboard
A Flutter SDK for integrating SurePass Video KYC verification.
SurePass Video KYC Flutter SDK #
A Flutter SDK for integrating SurePass Video KYC verification into your mobile app. It runs the entire video-based KYC flow inside a secure WebView on both Android and iOS. You declare the required camera, microphone, and location permissions in your app (see Platform setup); the SDK then requests them at runtime when the flow starts.
Features #
- One-call integration — launch the full Video KYC flow with a single function.
- Cross-platform — Android (API 28+) and iOS (15.0+).
- Runtime permission requests — prompts for camera, microphone, and location when the flow starts (declare them in your app first — see Platform setup).
- Typed result — get back a
success,cancelled,failed, orerrorstatus with the session id. - Environment support — switch between sandbox and production with a single enum.
- Initialization callback — an optional
onInitializedhook surfaces session data as soon as it's available.
Installation #
Add the dependency to your pubspec.yaml:
dependencies:
videokyc_flutter: ^1.0.1
Then fetch it:
flutter pub get
Platform setup #
The SDK requests these permissions at runtime, but it cannot declare them for you. You must add the entries below, or the requests will fail (and on iOS, a missing Info.plist key will crash the app).
Android #
Add the following to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
Ensure minSdkVersion is 28 or higher in android/app/build.gradle.
iOS #
Add the following keys to ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>Camera access is required for video KYC verification.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required for video KYC verification.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location access is required for video KYC verification.</string>
Set the minimum iOS version to 15.0 in ios/Podfile:
platform :ios, '15.0'
Usage #
Import the package and start the flow:
import 'package:videokyc_flutter/videokyc_flutter.dart';
final result = await startSurepassVideoKyc(
context: context,
token: 'your_surepass_api_token',
env: Env.sandbox, // or Env.prod
workflowId: 'your_workflow_id',
email: 'user@example.com',
fullName: 'John Doe',
mobileNumber: '+911234567890',
onInitialized: (VideoKycModel model) {
// Fired once the Video KYC session is initialized.
debugPrint('User: ${model.userId}, session: ${model.sessionId}');
},
);
switch (result?.status) {
case VideoKycStatus.success:
debugPrint('KYC completed — session ${result!.sessionId}');
break;
case VideoKycStatus.cancelled:
debugPrint('KYC cancelled by the user');
break;
case VideoKycStatus.failed:
debugPrint('KYC failed');
break;
case VideoKycStatus.error:
debugPrint('KYC error: ${result!.errorMessage}');
break;
case null:
debugPrint('Flow dismissed before reaching a terminal status');
break;
}
Parameters #
| Parameter | Required | Description |
|---|---|---|
context |
✅ | BuildContext used to push the KYC flow. |
token |
✅ | Your SurePass API authentication token. |
env |
✅ | Environment — Env.sandbox or Env.prod. |
workflowId |
✅ | Your SurePass workflow id. |
email |
✅ | User's email address. |
fullName |
✅ | User's full name. |
mobileNumber |
✅ | User's mobile number. |
onInitialized |
— | Callback receiving the VideoKycModel when the session initializes. |
The VideoKycModel passed to onInitialized contains userId, workflowId, sessionId, videoKycUrl, and the optional workflowSessionId, eventType, and signature.
Result #
startSurepassVideoKyc() returns a SurepassVideoKycResult?. It is null if the flow is dismissed before reaching a terminal status; otherwise it exposes:
status—VideoKycStatus.success,cancelled,failed, orerror.sessionId— the session id for tracking (when available).errorMessage— populated whenstatusiserror.
Permissions #
These permissions must be declared in your app first (see Platform setup) — the SDK cannot add them for you:
- Camera — capturing video during verification.
- Microphone — audio during the video session.
- Location — location verification.
When the flow starts, the SDK requests any of these that aren't already granted, and the in-flow WebView re-requests them on demand if the verification page asks. If a required permission is denied, the flow ends with VideoKycStatus.error.
Environments #
| Environment | Base URL |
|---|---|
Env.sandbox |
https://superflow-sandbox.surepass.io |
Env.prod |
https://superflow.surepass.io |
Error handling #
The returned status reflects how the flow ended, covering network errors, permission denials, API failures, and user cancellations. Handle each VideoKycStatus case (and the null "dismissed" case) as shown in Usage.
Requirements #
- Flutter SDK
>=3.0.0 <4.0.0 - Android API level 28 or higher
- iOS 15.0 or higher
Dependencies #
Built on top of flutter_inappwebview (WebView), permission_handler (runtime permissions), dio (networking), and provider (state).
Support #
For issues, questions, or feature requests, contact SurePass support or visit the SurePass documentation portal.
License #
Released under the MIT License — see LICENSE for details.