Live demo of agent247 on Digio's docs — click the orange button at the bottom right to start.

Flutter eSign/eMandate SDK

Getting Started

kyc_workflow

Sample code base repo Please follow the following test app code for any confusions

Run this command with Flutter:

 flutter pub add kyc_workflow

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  kyc_workflow: ^version [1.x.x]

1. Android

1. Add it to your root build.gradle at the end of repositories:

allprojects {
  repositories {
     ...
     maven { url 'https://jitpack.io' }
  }
}

2. Add the dependency:

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

3. Check your app’s build.gradle file (android/apps/build.gradle) to confirm a declaration similar to the following (depending on the build configuration you’ve selected):

android {
    compileSdkVersion 35

    defaultConfig {
        minSdkVersion 24
    }

    buildFeatures {
        viewBinding true
        dataBinding true
    }

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

Digio SDK supports android version 7.0 and above (SDK level 24 above)

4. Module Build Gradle (android/build.gradle) has following

buildscript {
    ext.kotlin_version = "1.8.22"
    dependencies {
        classpath("com.android.tools.build:gradle:8.1.0")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
    }
}

Note: Kotlin plugin should be added at your project level inside build gradle

5. Add buildType release and debug. You can add minifyEnabled as true

 buildTypes {

        release {
            signingConfig signingConfigs.debug
            minifyEnabled true
        }
        debug {
            signingConfig signingConfigs.debug
            minifyEnabled false
        }
    }

6. Add required permissions in manifest file and run time.

<!--RECORD_AUDIO and MODIFY_AUDIO_SETTINGS Permission 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" />

<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

A fintech Android app can't access the following permission

  • Read_external_storage
  • Read_media_images
  • Read_contacts
  • Access_fine_location
  • Read_phone_numbers
  • Read_media_videos

You get a build error due to a theme issue.

- Please add tools:replace="android:theme" under your android manifest.

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

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

Proguard :

It is required to test the release build for possible proguard exceptions before prod releases.

-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}
-keepattributes JavascriptInterface
-keepattributes *Annotation*
-keepattributes Signature
-optimizations !method/inlining/*
-keeppackagenames
-keepnames class androidx.navigation.fragment.NavHostFragment
-keep class * extends androidx.fragment.app.Fragment{}
-keepnames class * extends android.os.Parcelable
-keepnames class * extends java.io.Serializable
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-dontwarn androidx.databinding.**
-keep class androidx.databinding.** { *; }
-keepclassmembers class * extends androidx.databinding.** { *; }
-dontwarn org.json.**
-keep class org.json** { *; }
-keep public class org.simpleframework.**{ *; }
-keep class org.simpleframework.xml.**{ *; }
-keep class org.simpleframework.xml.core.**{ *; }
-keep class org.simpleframework.xml.util.**{ *; }
-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.** { *; }
-keep class com.google.android.material.** { *; }
-dontwarn org.simpleframework.**
-keepattributes ElementList, Root
-keepclassmembers class * {
    @org.simpleframework.xml.* *;
}
-keep class org.spongycastle.** { *; }
-keep class com.ecs.rdlibrary.request.** { *; }
-keep class com.ecs.rdlibrary.response.** { *; }
-keep class com.ecs.rdlibrary.utils.** { *; }
-keep class com.ecs.rdlibrary.ECSBioCaptureActivity { *; }
-keep class org.simpleframework.xml.** { *; }
-keepattributes Exceptions, InnerClasses
-keep class com.google.android.gms.location.LocationSettingsRequest$Builder { *; }
-keepnames class ** { *; }
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
-keepattributes AnnotationDefault
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}
-dontwarn javax.annotation.**
-dontwarn kotlin.Unit
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface * extends <1>
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
-keep,allowobfuscation,allowshrinking class retrofit2.Response
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz
-dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
-keep class * extends androidx.databinding.DataBinderMapper
-keep class javax.xml.bind.annotation.** { *; }
-dontwarn javax.xml.bind.annotation.**
-keep class com.ecs.cdslxsds.ESignProcessorResponse { *; }

2. IOS

How to Integrate?

  1. In case of iOS, No need to put SDK. You can proceed with writing the code below.
  2. DigioKycSDK requires permission mentioned below. Make sure to add these permissions in your app's info.plist
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your camera.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your location.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your location.</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your microphone to capture video.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your photo.</string>

Add LSApplicationQueriesSchemes in your iOS app's Info.plist file

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

Digio SDK support for xcode 16.2 and above, Swift version 5.7

Also refer ios guide for ios folder setup : IOS Setup Guide

Starting the digio kyc workflow

Import in your Dart code, you can use:

import 'package:kyc_workflow/kyc_workflow.dart';
....
HashMap<String, String> additionalData = HashMap<String, String>();
additionalData["dg_disable_upi_collect_flow"] = "false"; // optional for mandate

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

final _kycWorkflowPlugin = KycWorkflow(digioConfig);
_kycWorkflowPlugin.setGatewayEventListener((GatewayEvent? gatewayEvent) {
    print("gateway event : " + gatewayEvent.toString());
});
workflowResult = await _kycWorkflowPlugin.start("KID23010416361850266BAKNKNORLP6W","abc@gmail.com","GWT230104163618520T2Y9IPUT2PBNC8",additionalData);
print('workflowResult : ' + workflowResult.toString());

Sample Response

documentIdDID22040413040490937VNTC6LAP8KWDString format (Request ID Passed by parent app)
messageSigning SuccessSigning Failure
Failure = Digio sdk crash
Webpage could not be loaded = web page not loaded due to internet connection issue even after 3 retries.
code1001
(App should only depend upon the code not on message to check failure or success)
DigioConstants.RESPONSE_CODE_SUCCESS = 1001
RESPONSE_CODE_CANCEL = -1000
RESPONSE_CODE_FAIL = 1002
RESPONSE_CODE_WEB_VIEW_CRASH = 1003
RESPONSE_CODE_SDK_CRASH = 1004
screendocument_preview
npciTxnIdString
stacktraceIn case of digio sdk crashes, the crash log

Gateway Event Doc

Was this page helpful?