(Legacy) Web SDK KYC integration v1

 


Table of Contents


Introduction

The current flow only allows using the SDK by installing it through npm or using it as a script.


Latest version


Compatibility

  • Supported: Only for web browsers (Chrome, Firefox, Safari, Edge etc.).

  • Not supported: Native application languages like React-Native, Flutter etc. For that, please refer to Mobile SDK.


How to install?

SDK flow explained in a sandbox environment:

  • There are 2 ways to use the IDV SDK:

    1. Via npm - @Ondato-public/idv-sdk

    2. By adding a script to an application <script src="{baseUrl}/index.1.x.x.min.js"></script>

The SDK can be utilized by generating an idv ID or by using idv setupId (where the idv id is generated automatically).


Flows explained

  • Customize the script with the following required properties:

    • IdvSdk.load({ mode: IdvSdkMode.Sandbox, onSuccess: (props) => console.log('onSuccess', props), onFailure: (props) => console.log('onFailure', props), onClose: () => console.log('onClose'), });
      • Both begin() and load() should be used in try catch block.

      • load()

        1. Purpose: Configures api.

        2. Returns begin() and end() methods if success

        3. mode interface(for setting environment):

          • declare enum IdvSdkMode { Production = "Production", Sandbox = "Sandbox" }
        4. Exceptions explained:

          declare enum IdvSdkLoadFailure { NotSupportedMode = 'NotSupportedMode' // incorrect mode(environemnt) provided }

  • Events

    • onSuccess and onFailure: callback with returned props, onClose without props.

    • On every callback idv sdk application is closed.

    • Exceptions explained:


  • After setting up properties for IDV SDK load({mode,onSuccess, onFailure})

    • begin()

      • Purpose: Creates idv session.

      • Props explained:

      • When using idvId, it is recommended to save the idvID in your application's session storage.

        • In the case of an F5 (page refresh), the same id will be used, and the same session will be loaded. If you encounter this scenario, retry: true should only be set after the refresh. Otherwise, when refreshing the page, idvId would be invalidated.

      • Exceptions explained:

    • end()

      • Closes SDK application without error. Cleans up all sdk tasks and application.

      • Props: does not accept any properties.


Customization

  • customiseStyle(options)

    • This function allows to set some IDV SDK styles.

    • Optional.

    • Call before begin() method. to applie style.

      • Options:

  • version() returns current sdk version


Examples

Script


npm (React example):

  1. specify registry in .npmrc

  2. in package.json specify version “@ondato-public/idv-sdk": "1.x.x" and npm install

  3. Example import can be found in App.tsx in idv_sdk_npm_example zip


Extra

Interfaces and declarations files


How to generate IDV ID?