Skip to main content

kyc_workflow 2.1.1 copy "kyc_workflow: ^2.1.1" to clipboard
kyc_workflow: ^2.1.1 copied to clipboard

Digio kyc workflow plugin

Digio KYC Workflow Plugin #

A Flutter plugin for running Digio's KYC, eSign, mandate, UPI, and RPD flows on Android and iOS.

The plugin exposes two ways of using the Digio SDK from your app. Pick the one that fits your use case:

Mode When to use it Supported flows Entry point
Workflow You want the full Digio-orchestrated journey. Your backend has created a workflow request and issued you a documentId + tokenId. KYC, Mandate, UPI, RPD, eSign (via OTP / Fingerprint / Face / Iris) KycWorkflow.start(...)
Stateless You want a pure native SDK experience for a standalone task. Your backend issues a JWT that carries the Digio credentials — the SDK reads the token and handles the rest. Selfie (Android + iOS) KycWorkflow.startStateless(...)

Table of Contents #

Upgrading from kyc_workflow 2.0.x? See MIGRATION.md for the step-by-step 2.0.x → 2.1.0 guide (Built-in Kotlin migration, new toolchain floors, troubleshooting, rollback).


Android setup #

Digio SDK supports Android 7.0 and above (SDK level 24+).

Toolchain compatibility #

Starting with kyc_workflow v2.1.0, the plugin follows Flutter's Built-in Kotlin convention — your host app supplies AGP and KGP; the plugin inherits them.

Tool Minimum (Flutter 3.22+) Recommended (Flutter 3.47+)
AGP (Android Gradle Plugin) 8.4 9.0.1
KGP (Kotlin Gradle Plugin) 1.9.24 2.3.20
Gradle 8.9 9.1.0
Android NDK 27.x 28.2.13676358
compileSdk 35 35+
minSdk 24 24
Java / jvmTarget 17 17
Flutter 3.22.0 3.47+
Dart 3.4.0 3.4+

Partners on Flutter 3.47+ must use AGP ≥ 8.11.1 and KGP ≥ 2.2.20 — Flutter itself enforces these floors. The plugin remains compatible across both the AGP 8.x and AGP 9.x lines as long as your Flutter version is met.

1. android/settings.gradle (host app) #

Partners must declare the required Maven repositories and plugin versions at the settings level. This is the Built-in Kotlin pattern — it replaces the older buildscript/allprojects blocks.

pluginManagement {
    // ... Flutter plugin loader as generated by `flutter create` ...
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "9.0.1" apply false
    id "org.jetbrains.kotlin.android" version "2.3.20" apply false
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        maven { url 'https://storage.googleapis.com/download.flutter.io' }
    }
}

Why PREFER_SETTINGS: Flutter's Gradle plugin auto-injects a project-scoped repository on :app. In Gradle's default PREFER_PROJECT mode this suppresses every settings-level repository → the plugin's dependencies (jitpack AARs, mavenCentral / google artifacts) fail to resolve. PREFER_SETTINGS forces the settings repositories to win and the plugin resolves cleanly.

2. android/app/build.gradle (host app) #

plugins {
    id "com.android.application"
    id "kotlin-kapt"             // keep — needed for dataBinding
    // The Flutter Gradle Plugin must be applied after the Android plugin.
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "<your.app.namespace>"
    compileSdk = 36
    ndkVersion = "28.2.13676358"   // match the Digio AAR requirement

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }

    defaultConfig {
        applicationId "<your.app.id>"
        minSdkVersion 24
        
    }

    buildFeatures {
        viewBinding = true
        dataBinding = true
    }
}

dependencies {
    implementation 'com.github.digio-tech:protean-esign:v3.12'
}

Note on kotlinOptions: Flutter's Built-in Kotlin guide recommends removing this block entirely. On KGP 2.3.20 the default jvmTarget is 21, which mismatches compileOptions at 17 and fails the build. Keep kotlinOptions { jvmTarget = '17' } as the parity shim until you also bump compileOptions to Java 21.

3. Do NOT add a top-level buildscript/allprojects block #

Older integration guides told partners to add buildscript { ext.kotlin_version = ...; classpath "com.android.tools.build:gradle:..." } and allprojects { repositories { ... } } to the project-level build.gradle. From kyc_workflow v2.1.0 onwards, remove these blocks — Flutter's dev.flutter.flutter-plugin-loader + the settings.gradle snippet above do the job. Keeping the legacy blocks re-triggers the applies KGP warning Flutter will hard-fail on.

4. Manifest permissions #

<!-- Required for Video KYC -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

<!-- Required for geotagging -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<!-- Required for ID card analysis, selfie and face match -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />

A fintech Android app cannot access these permissions: READ_EXTERNAL_STORAGE, READ_MEDIA_IMAGES, READ_CONTACTS, ACCESS_FINE_LOCATION, READ_PHONE_NUMBERS, READ_MEDIA_VIDEOS.

Common Android issues #

Build error due to a theme conflict — add tools:replace="android:theme" under your <application> tag:

<application
    ...
    tools:replace="android:label,android:theme"
    ...>
    ...
</application>

Crash related to the AppCompat theme while using eSign — set an AppCompat theme on the <application> tag:

<application
    ...
    android:theme="@style/Theme.AppCompat.Light.NoActionBar"
    ...>
    ...
</application>

iOS setup #

No manual SDK installation is required for iOS. Digio SDK supports Xcode 14.0+, Swift 5.7+, and iOS 15.1+.

Package manager — CocoaPods or Swift Package Manager #

Starting with v2.0.30, the plugin ships both a CocoaPods podspec and a Swift Package Manager manifest. You don't choose — Flutter picks the right one based on your project configuration:

Your setup What runs
Flutter ≥ 3.47.7 with flutter config --enable-swift-package-manager SPM path (fetches Digio frameworks repo)
Any other configuration CocoaPods path (fetches Digio frameworks from the Pods spec repo)

No code changes are required on either path. Both resolve to the same native Digio iOS SDKs and produce the same journey behavior.

Info.plist permissions #

<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your camera.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your photo.</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your microphone to capture video.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your location.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your location.</string>

LSApplicationQueriesSchemes (needed for UPI apps) #

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>phonepe</string>
    <string>gpay</string>
    <string>paytmmp</string>
    <string>bhim</string>
    <string>upi</string>
    <string>ppe</string>
</array>

Usage — Workflow mode #

Use this when your backend has created a Digio workflow request and given you a documentId and tokenId. The SDK will drive the entire journey on its own — this includes:

  • KYC (identity verification, document capture, video KYC, geotagging)
  • Mandate (eNACH / UPI mandate)
  • UPI (collect, intent)
  • RPD (Reverse Penny Drop — bank account verification)
  • eSign — with authentication via OTP, Fingerprint (FP), Face, or Iris

Which flow actually runs is decided by the workflow you configured on the Digio backend — your Flutter code just starts it.

HashMap<String, String> additionalData = HashMap<String, String>();
additionalData["dg_disable_upi_collect_flow"] = "false"; // optional, for mandate

final digioConfig = DigioConfig();
digioConfig.theme.primaryColor = "#32a83a";
digioConfig.logo = "https://your_logo_url";
digioConfig.environment = Environment.SANDBOX;
digioConfig.serviceMode = ServiceMode.OTP; // FP / FACE / IRIS / OTP
digioConfig.global = false;

final kycWorkflow = KycWorkflow(digioConfig);

kycWorkflow.setGatewayEventListener((GatewayEvent? event) {
  print("gateway event: $event");
});

final workflowResult = await kycWorkflow.start(
  "KID23010416BAKNKNORLP6W",  // documentId
  "abc@gmail.com",                     // identifier (customer)
  "GWT230109IPUT2PBNC8",  // tokenId
  additionalData,
);

print('workflowResult: $workflowResult');

Usage — Stateless mode #

Stateless mode gives a pure native SDK experience. Your app tells the SDK which task to run (currently only Selfie) and passes a JWT token issued by your backend. That JWT carries the Digio credentials the SDK needs — clientSecret, transactionId, templateName, customerIdentifier, expirySeconds — so your app never has to handle them directly. The SDK decodes the token and runs the task natively.

Supported features today: SELFIE (Android + iOS).

How the JWT works #

  1. Your backend calls Digio to prepare a task (selfie capture) and gets back the credentials.
  2. Your backend wraps those credentials into a short-lived JWT and hands it to your Flutter app. Check FAQ JWT generation process
  3. Your app passes that JWT + the feature list into startStateless(...).
  4. The SDK opens the native screen, runs the task, and returns a result — no further backend calls from your Flutter code.

Example — Selfie #

import 'package:kyc_workflow/kyc_workflow.dart';
import 'package:kyc_workflow/environment.dart';
import 'package:kyc_workflow/digio_config.dart';
import 'package:kyc_workflow/stateless/stateless_config.dart';
import 'package:kyc_workflow/stateless/stateless_feature.dart';
import 'package:kyc_workflow/stateless/selfie_config.dart';

final config = StatelessConfig(
  environment: Environment.SANDBOX,
  clientId: 'YOUR_CLIENT_ID',
  token: 'JWT_FROM_YOUR_BACKEND',
  features: [StatelessFeature.SELFIE],
  selfieConfig: SelfieConfig(
    autoCapture: false,
    showInstruction: false,
    hasGeotagging: false,
    logoUrl: 'https://your_logo_url',
  ),
);

final kyc = KycWorkflow(DigioConfig());

kyc.setStatelessEventListener((event) {
  print('stateless event: screen=${event.screen}, action=${event.action}');
});

final response = await kyc.startStateless(config);
print('status: ${response.status}');
print('results: ${response.results}');
print('error: ${response.error}');

StatelessConfig fields #

Field Required Description
environment Yes (default PRODUCTION) Environment.SANDBOX for testing, Environment.PRODUCTION for live.
clientId Yes Your Digio client ID.
token Yes The JWT issued by your backend. Encodes clientSecret, transactionId, templateName, customerIdentifier, expirySeconds.
features Yes List of tasks to run. Currently: SELFIE.
selfieConfig Only if SELFIE is in features See below.

SelfieConfig fields #

Field Default Description
autoCapture false Automatically capture when the face is aligned.
showInstruction true Show the instructions screen before the camera opens.
hasGeotagging false Attach the user's location to the capture.
logoUrl null Your logo shown on the SDK screens.

StatelessResponse #

Field Description
status FlowStatus.SUCCESS, FAILED, or CANCELLED.
results List of SdkTaskResponse — one per feature you requested.
error Human-readable error string, if any.

Sample success response (Selfie)

StatelessResponse(
  status = SUCCESS,
  results = [
    SdkTaskResponse(
      feature = SELFIE,
      status  = SUCCESS,
      data    = {
        "success": true,
        "kyc_request_id": "KID260413170XXXXXXYKE442HLKC82",
        "kyc_details": {
          "id": "KID2604131700XXXXXXE442HLKC82",
          "created_at": "2026-04-13 17:00:39",
          "status": "approval_pending",
          "customer_identifier": "ak@digio.in",
          "actions": [
            {
              "id": "KIA26041317XXXXXXXZ4USGPLFGRLD",
              "action_ref": "selfie-1",
              "type": "selfie",
              "status": "success",
              "file_id": "FIL26041XXXXWWIHL6GKWDRXI5",
              "validation_result": {
                "LIVENESS_CHECK": {
                  "score": 0.9954740107059479,
                  "result": "PASS",
                  "additional_details": "{\"success\":true,\"overall_passed\":true,\"face_proportion_check\":\"PASS\"}"
                }
              },
              "completed_at": "2026-04-13 17:00:40",
              "face_match_obj_type": "source",
              "face_match_status": "new",
              "obj_analysis_status": "na",
              "method": "otp_none",
              "processing_done": false,
              "retry_count": 1,
              "file_base64": "/9j/4AAQSkZJRgABAQAAAAAAAAD..."
            }
          ],
          "reference_id": "CRN26XXXXX003943552",
          "transaction_id": "TXN17760798321144909",
          "expire_in_days": 10,
          "reminder_registered": false,
          "workflow_name": "your_workflow_name",
          "auto_approved": false,
          "template_id": "KTP260401xxxxxxIQH8TN9TO6J9"
        },
        "latitude": 12.9300036936,
        "longitude": 77.68300086781973,
        "croppedFacePath": "/data/user/0/<your.app.id>/no_backup/digio_cropped/digio_1795145315321.jpg"
      },
      error = null
    )
  ]
)

Key fields partners usually consume:

Path What it is
data.kyc_request_id The Digio KYC request ID for this selfie session. Use this to reference the capture on your backend.
data.kyc_details.id Same ID in the embedded details block.
data.kyc_details.status Digio-side status — e.g. approval_pending, approved.
data.kyc_details.actions[].file_id Digio file ID for the captured selfie — fetch via Digio's REST API.
data.kyc_details.actions[].validation_result.LIVENESS_CHECK.result PASS / FAIL — the ML liveliness verdict.
data.kyc_details.actions[].validation_result.LIVENESS_CHECK.score 0..1 liveness confidence.
data.kyc_details.actions[].validation_result.LIVENESS_CHECK.additional_details Stringified JSON with per-check verdicts (deepfake, blur, lighting, eyes-open, gender/age classifiers, etc.).
data.kyc_details.actions[].file_base64 Base64 of the captured selfie — handy for client-side preview without a backend fetch.
data.croppedFacePath Local file paths on the device — useful for showing the capture immediately after the flow.
data.latitude / data.longitude Device geotag if hasGeotagging = true in SelfieConfig.

data is delivered as a plain Map<String, dynamic> on the Dart side. Partners typically pull kyc_request_id for their backend reconciliation and file_id for downstream retrieval; everything else is diagnostic.


Response codes #

The code field in the workflow response is the single source of truth — do not parse the message string.

Field Example Description
documentId DID22040413040490937VNTC6LAP8KWD Request ID passed by the parent app.
message Signing Success Human-readable status. May be Signing Failure, Failure (SDK crash), or Webpage could not be loaded (network issue after 3 retries).
code 1001 Machine-readable status — see codes below.
screen document_preview Last screen the user was on.
npciTxnId — NPCI transaction ID (UPI flows).
stacktrace — Crash log, present only on SDK crash.

Response code constants:

Constant Value
DigioConstants.RESPONSE_CODE_SUCCESS 1001
RESPONSE_CODE_CANCEL -1000
RESPONSE_CODE_FAIL 1002
RESPONSE_CODE_WEB_VIEW_CRASH 1003
RESPONSE_CODE_SDK_CRASH 1004

More references #

8
likes
130
points
16k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Digio kyc workflow plugin

Homepage

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on kyc_workflow

Packages that implement kyc_workflow