Incode Cordova SDK reference

Incode Welcome

Incode Welcome provides effortless onboarding where security matters.
Incode Welcome is part of Incode Omnichannel Biometric Identity Platform, that is powered by Incode's world class Face Recognition, Liveness detection and ID Validation models. Organizations can choose to have an optional video conference to additionally verify the customer’s identity.

In this repo you can find an example of onboarding app that uses Cordova Plugin to to enable remote account opening.

Supported Android Version

API 21+ & CompileSDK version 31.

Supported iOS Version

iOS 13+

Additional Steps for iOS

  1. For Cordova

    
    Run "pod install" under ios folder
    
    
  2. For Capacitor/Ionic

    a. Copy below lines in the pod file

    
    source 'https://github.com/CocoaPods/Specs.git'
    source '[email protected]:Incode-Technologies-Example-Repos/IncdDistributionPodspecs.git'
    
    

    b. Run "pod install" under ios/app folder or "pod install --repo-update" under ios/app folder

    c. npx cap sync

Documentation

Install the Incode Cordova plugin in your app path using command:

 cordova plugin add incode-cordova-plugin
 
 OR

 cordova plugin add https://github.com/Incode-Technologies-Example-Repos/incode-cordova-plugin.git

 

As our SDK needs camera to capture Id and face, use command:

cordova plugin add cordova-plugin-camera

Same applies for GeoLocation if its required use command:

cordova plugin add cordova-plugin-geolocation

Implementation

Following functions can be used to initialize the SDK with different modules as per your business requirement.

  1. SDK Initialize - Below function will initialize Incode SDK which is required at least once in app life cycle.
     cordova.exec(function(param) {
             console.log("Success: "+param);
            // start the Incode session here
             }, function(err) {
              console.log("Error: "+ err);
               // handle the error by showing some UI or alert.
           }, "Cplugin", "initializeSDK", [apiKey, apiUrl, loggingEnabled, testMode]); 
           
Above function take following mandatory parameters
1. apiKey - String - Pass here API mentioned in your delivery document
2. apiUrl - String - Pass here API URL mentioned in your delivery document.
3. loggingEnabled - String - true/false should be the value to enable or disable logging.
4. testMode - Set to true if running on simulator/emulators, false when running on devices. Default false.
  1. Start the session - Below function will start the fresh session when nothing passed in interviewId. Or else reopens the existing session. It returns interviewId and token on success callback.
    cordova.exec(function(data) {
                       console.log("OnSession created Success: "+data.interviewId + " Token:"+data.token);
                       // Start the Incode modules or sections from here
                       }, function(err) {
                        console.log(" startSession Error: "+ err);
                         // handle the error by showing some UI or alert.
                     }, "Cplugin", "setupOnboardingSession", [configId, externalId, interviewId, externalToken]);
                     
 Above function take following mandatory parameters
1. configId - String - This id can be taken from our Incode dashboard also called as flow id. This will apply backend settings as per set on dashboard.
2. externalId - String - This is the custom id which client can pass based on their unique identifier of the user. If not used pass null.
3. interviewId - String - This is the session id on our dashboard if you want to restart same session then pass id here. If not used or first time session this should be null. 
4. externalToken - String - This is the session token generated by your backend after calling our `omni/start` API(make sure to add token value in this parameter). configId can be null if this is passed.

    To Set theme for iOS, use below fucntion. Make sure to call this function before startOnboardingSection.

    cordova.exec(function(param) {
             }, function(err) {
                    console.log("Error in set Theme: "+ err);
           }, "Cplugin", "setTheme", [jsonTheme]);

  1. Start the section by clubbing multiple modules. Refer code below to start the section with default settings.

  cordova.exec(function(winParam) {
                                    console.log("Phone added Success: "+winParam);
                                   // handle the response here
                                    }, function(err) {
                                     console.log("Error: "+ err);
                                     // handle the error by showing some UI or alert.
                                  }, "Cplugin", "startOnboardingSection", [ 
                                  {"module":"addPhone"},{"module":"addGeolocation"},
                                  {"module":"addUserConsent","title":"Title","content":"Content"},        
                                  {"module":"addMachineLearningConsent","consentType":"US"},
                                  {"module":"addId","showTutorials":"true","waitForTutorials":"false",
                                    "idCategory":"FIRST","enableBackShownAsFrontCheck":"true",
                                    "enableFrontShownAsBackCheck":"true","autocaptureUXMode":"HOLDSTILL"},
                                  {"module":"addSelfieScan","showTutorials":"true","waitForTutorials":"false",
                                    "maskCheckEnabled":"true","lensesCheckEnabled":"true"},
                                  {"module":"addFaceMatch"},
                                  {"module":"addEKYC"},
                                  {"module":"addAntifraud"},
                                  {"module":"addGovernmentValidation"},
                                  {"module":"addDocumentScan","documentType":"ADDRESS_STATEMENT"},
                                   {"module":"addSignature"}]);
                                  
Our Cordova plugin supports following UI & Non UI modules:
 1. addPhone
 2. addGeolocation
 3. addId
 4. addSelfieScan
 5. addFaceMatch
 6. addSignature
 7. addGovernmentValidation
 8. addDocumentScan
 9. userScore
 10. approve (Non UI)
 11. getUserScore (Non UI)
 12. faceMatch (Non UI)
 13. startFaceLogin
 14. finishOnboarding (Non UI)
 15. addVideoSelfie
 16. addEKYC
 17. addAntifraud
 

To load individual modules one at a time refer below example. For all the modules checkout our sample code.

 cordova.exec(function(winParam) {
                           console.log("Phone added Success: "+winParam);
                           //start next module here
                           }, function(err) {
                            console.log("Error: "+ err);
                             // handle the error by showing some UI or alert.
                         }, "Cplugin", "startOnboardingSection", ["addId"]);
                         
                         

To fetch scores or results once onboarding modules are done.

     cordova.exec(function(winParam) {
                  myObj = JSON.stringify(winParam);
                  console.log("Score : "+myObj);
                }, function(err) {
                  console.log("Error: "+ err);
           }, "Cplugin", "getUserScore", ["fast"]);

To finish the session below code is mandatory after all sections or modules are completed successfully. This should be called only once when all the sections are done.

cordova.exec(function(winParam) {
          console.log("finishOnboarding Success: "+winParam);
         }, function(err) {
           console.log("Error: "+ err);
         callbackError('Nothing to echo.' +err);
    }, "Cplugin", "finishOnboarding", []);
    

Make sure to delete local cache data once all all the above steps are over.

cordova.exec(function(winParam) {
               console.log("deleteLocalUserData Success: "+winParam);
             }, function(err) {
               console.log("Error: "+ err);
        }, "Cplugin", "deleteUserLocalData", []);

License

Copyright 2024 Incode Technologies. All rights reserved.