Using Dynamic SDK

Introduction

The IDWise Dynamic SDK is designed for advanced integrations, giving hosting apps full control over ID verification steps. Your app manages the transition between each step (e.g., document or selfie step), allowing for greater flexibility but requiring more integration effort. For most cases, the Standard SDK is recommended. See the full comparison between the Standard and Dynamic SDKs here.


Requirements and Installation

Please refer to this link for requirements and steps to install the IDWise SDK per platform


Full Integration Sequence Diagram Using Dynamic SDK

Here is a sequence diagram illustrating the steps to integrate with IDWise Dynamic SDK.


Dynamic SDK Usage

Below are the steps to integrate with the IDWise Dynamic SDK.

1. Import the SDK into your project

You can import the SDK into your code file as follows:

import IDWiseSDK
import com.idwise.sdk.IDWiseDynamic
import com.idwise.sdk.data.models.*
import ‘package:idwise_flutter_sdk/idwise.dart’;
import {IDWise} from 'idwise-react-native-sdk/src/IDWise';
import {IDWiseSDKTheme} from 'idwise-react-native-sdk/src/IDWiseConstants';
There is no need to Import SDK in Capacitor

2. Initialize the SDK

To use the Dynamic SDK, you have to initialize it by calling the following method:

let clientKey = "<YOUR_CLIENT_KEY>"
let theme = IDWiseTheme.systemDefault //[.light, .dark, .systemDefault]

IDWiseDynamic.initialize(clientKey: clientKey,theme: theme) { err in
    if let error = err {
      	// handle error, show some alert or any other logic
     }
}
val clientKey = "<YOUR_CLIENT_KEY>"
val theme = IDWiseTheme.SYSTEM_DEFAULT //[LIGHT, DARK, SYSTEM_DEFAULT]

IDWiseDynamic.initialize(clientKey=clientKey, theme=theme) {
    error: IDWiseError? -> error?.printStackTrace() 
}
String clientKey = "<YOUR_CLIENT_KEY>"
IDWiseTheme theme = IDWiseTheme.LIGHT //[DARK, LIGHT, SYSTEM_DEFAULT]

IDWiseDynamic.initialize(clientKey,theme, onError:(error){
   print("Error in initializeSDK");
   print(error);
});
const clientKey = "<YOUR_CLIENT_KEY>";
const theme = IDWiseTheme.SYSTEM_DEFAULT; //[LIGHT, DARK, SYSTEM_DEFAULT]
IDWiseDynamic.initialize(clientKey, theme, {
  onError(error) {
      console.log(' onInitializeError: ', error);
  }
});
function error(error) {
   //error callback for errors occured in initialize
    console.log(
      "onError :",
      error.code,
      error.message
    );
}

var clientKey = "CLINT_KEYE"; //provided by IDWise
var theme = "SYSTEM_DEFAULT"; //available values: LIGHT, DARK, SYSTEM_DEFAULT

IDWiseDynamic.initialize(clientKey, theme, error);

The initialize method accepts two parameters:

  • clientKey: A key used to authenticate your app with the IDWise backend. You can generate this key by following the instructions here.
  • theme: Defines the appearance (Dark/Light Mode) for the IDWise SDK screens. If set to systemDefault, the SDK will automatically follow the device's system mode.

3. Start a New Journey

After initializing the SDK, you can begin an ID verification journey. To initiate the process, use the startJourney method as shown below.

let flowId = "<FLOW_ID>"
let referenceNo = "<REFERENCE_NUMBER>"
let locale = "en"
let applicantDetails: [String:String] = [
            ApplicantDetailsKeys.FULL_NAME: "John Doe",
            ApplicantDetailsKeys.BIRTH_DATE: "1995-05-06",
            ApplicantDetailsKeys.SEX: "male"
        ]//Optional

IDWiseDynamic.startJourney(flowId: flowId,
                           referenceNumber: referenceNo,
                           locale: locale,
                           applicantDetails: applicantDetails, // can be passed as nil If you don't want to pass any applicant details
                           journeyCallbacks: self,
                           stepCallbacks: self)
val flowId = "<FLOW_ID>"
val referenceNo = "<REFERENCE_NUMBER>"
val locale = "en"

//Optional 
val applicantDetails = hashMapOf<String, String>()
applicantDetails[ApplicantDetailsKeys.FULL_NAME] = "John Doe"
applicantDetails[ApplicantDetailsKeys.BIRTH_DATE] = "2000-02-01"
applicantDetails[ApplicantDetailsKeys.SEX] = "male"


IDWiseDynamic.startJourney(
  context = this,// Activity Context
  flowId = flowId,
  referenceNo = referenceNo,
  locale = locale,
  applicantDetails = applicantDetails, //Optional
  journeyCallbacks = journeyCallbacks,
  stepCallbacks = stepCallbacks
)
String flowId = "<FLOW_ID>"
String referenceNo = "<REFERENCE_NUMBER>";
String locale = "en";

//Optional
Map<String, String> applicantDetails = HashMap();
      applicantDetails["full_name"] = "John Doe";
      applicantDetails["sex"] = "Male";
     
IDWiseDynamic.startJourney(
          flowId: flowId,
          referenceNo: referenceNo,
          locale: locale,
          applicantDetails: applicantDetails,//Optional: can pass null if not required
          journeyCallbacks: _journeyCallbacks,
          stepCallbacks: _stepCallbacks);

var flowId = "<FLOW_ID>"
var referenceNo = "<REFERENCE_NUMBER>"
var locale = "en"

//Optional
const applicantDetails = {};
applicantDetails[ApplicantDetailsKeys.FULL_NAME] = 'John Doe';
applicantDetails[ApplicantDetailsKeys.BIRTH_DATE] = "2000-02-01"
applicantDetails[ApplicantDetailsKeys.SEX] = 'Male';

IDWiseDynamic.startJourney(
  flowId,
  referenceNo,
  locale,
  applicantDetails, //Optional. Can pass Null if not needed
  journeyCallbacks,
  stepCallbacks
);


var flowId = "<FLOW_ID>"
var referenceNo = "<REFERENCE_NUMBER>"
var locale = "en"

//Optional
const applicantDetails = {};
applicantDetails[ApplicantDetailsKeys.FULL_NAME] = 'John Doe';
applicantDetails[ApplicantDetailsKeys.BIRTH_DATE] = "2000-02-01"
applicantDetails[ApplicantDetailsKeys.SEX] = 'Male';

IDWiseDynamic.startJourney(
  flowId,
  referenceNo, 
  locale, 
  applicantDetails, //Optional. Can pass Null if not needed
  journeyCallbacks
);

This method takes the following parameters:

  • flowId: This is a unique identifier that identifies your journey flow. You can get access to all your flows from here .
  • referenceNo: (Optional) This is provided by your application and represents how you identify the user in your system (e.g., a UserID from your database or a phone number, etc.).
  • locale: (Optional) Specifies the language for the IDWise SDK screens. It should be a 2-letter ISO code (e.g., en for English, ar for Arabic, etc.). For a full list of supported languages, please contact IDWise Support.
  • applicantDetails: (Optional) This parameter allows you to pass user information collected in your system to the IDWise platform. This data will be cross-matched with the information extracted by IDWise from the user's documents.
  • journeyCallbacks: This parameter allows you to define event handlers at the journey level. The list of journey-level events can be found here.
  • stepCallbacks: This parameter lets you define event handlers at the step level. The details of step-level events are available here.

4. Start Step

To start a specific step you need just to call startStep as follows:

 IDWiseDynamic.startStep(stepId: String) 
IDWiseDynamic.startStep(
  context=context,
  stepId="STEP-ID"
)
IDWiseDynamic.startStep("STEP-ID");
IDWiseDynamic.startStep("STEP-ID");
IDWiseDynamic.startStep("STEP-ID");

📘

Important

Make sure you call startStep once the onJourneyStarted or onJourneyResumed callback is triggered.

stepId : The ID of the step you want to start. You can retrieve the step ID from the Flow Builder, where it will be highlighted in the corresponding step block of your flow.

The step capture UI will be shown to the user. once the user captures the image(s) and confirms the following callbacks will be triggered in this order:

  • onStepCaptured: This callback is triggered that contains the captured images in the callback payload.
  • onStepResult: This callback is triggered once the processing of the step is finished. The results you will receive in this callback can be found here.

If the user cancels the step instead of completing it then onStepCancelled callback will be triggered.

🔁

Note

Repeat the start step process for all remaining steps in your flow, one by one.

5. Complete Journey

Finally, after handling all the required steps you can call finishJourney method finish the journey.

IDWiseDynamic.finishJourney()
IDWiseDynamic.finishJourney()
IDWiseDynamic.finishJourney()
IDWiseDynamic.finishJourney()
IDWiseDynamic.finishJourney()

Note: Calling finishJourney when there are still incomplete mandatory steps, will cause the journey to refer, and any unsubmitted optional steps will be automatically skipped.

6. Getting the Journey Status

Once all user steps are completed and you want to check the journey status, you can do so by calling the IDWiseDynamic.getJourneySummary(...) method. This method returns a journey summary object. To determine if the journey status (Passed, or Failed), rely on the following conditions:

  • The journey is considered successful if isCompleted is True and journeyResult.interimRuleAssessment is Passed .
  • The journey is considered failed if journeyResult.interimRuleAssessment is Failed.

Refer here to comprehensive guide for get journey summary

7. Unloading the SDK

Unload the SDK once the journey is complete to free up resources or to start or resume another journey if needed. You can unload the SDK by calling the unloadSDK method as shown below.

IDWiseDynamic.unloadSDK()
IDWiseDynamic.unloadSDK()
IDWiseDynamic.unloadSDK()
IDWiseDynamic.unloadSDK()
IDWiseDynamic.unloadSDK()

📘

Info

To start another journey after unload the SDK you need to re-initialize the SDK again by calling initalize method

Skip Optional Steps

In some scenarios, your flow may include optional steps that you want to scan based on certain conditions. If you decide to skip a specific step, you can simply call the skipStep method as shown below.

IDWiseDynamic.skipStep(stepId: String)
IDWiseDynamic.skipStep(stepId="STEP-ID-TO-SKIP")
IDWiseDynamic.skipStep("STEP-ID-TO-SKIP");
IDWiseDynamic.skipStep("STEP-ID-TO-SKIP")
IDWiseDynamic.skipStep("STEP-ID-TO-SKIP")

stepId : ID of the step you want to skip.

📘

Info

Once the onJourneyStarted or onJourneyResumed callback is triggered, you can allow the user to start a step by calling startStep method.



Sample Project