HTML + Javascript

Steps to integrate the Web SDK into HTML and JavaScript application.

1. Installation

To install the Preventor Web SDK, add the following to your project:

Add https://sdk.preventor.com/pvtid/verifyme/verifyme.esm.js as a script.

<script
    type="module"
    src="https://sdk.preventor.com/pvtid/verifyme/verifyme.esm.js"
></script>

You have successfully installed the Preventor Web SDK!

2. Choose how you would like to integrate the verifyme

Integrating with verifyme through pvt-button is the easiest way to integrate.

  1. Add pvt-button tag in your HTML.

<pvt-button></pvt-button>
  1. Set your configuration

window.PvtVerifymeConfig = YOUR_CONFIGURATION;
  1. A complete HTMLfile should look similar to the example below.

<!DOCTYPE html>
<html lang="en">
  <body>
    <pvt-button></pvt-button>

    <script
        type="module"
        src="https://sdk.preventor.com/pvtid/verifyme/verifyme.esm.js"
    ></script>
    <script>
      // Your configuration
      // For more details refer to the "Prefilling configs" section
      window.PvtVerifymeConfig = {
        credentials: {
          apiKey: 'YOUR_API_KEY',
          clientSecret: 'YOUR_CLIENT_SECRET',
          tenant: 'YOUR_TENANT',
          banknu: 'YOUR_BANKNU',
          env: 'YOUR_ENV',
        },
      };
    </script>
  </body>
</html>

You can find your credentials on the Preventor platform

You have successfully Preventor SDK!

3. Prefilling configs

Prefill Flowtype

The flow type defines the biometric process so you must select a flow type.

const YOUR_CONFIGURATION = {
   // SET THE FLOW TYPE
   flowType: 'YOUR_FLOW_TYPE'
};

You must assign the flow type code. If it is blank, it will take the flow type by default.

Prefill Credentials

You must set all credentials values ​​to correctly consume our services.

const YOUR_CONFIGURATION = {
   flowType: 'YOUR_FLOW_TYPE',
   // SET THE CREDENTIALS
   credentials: {
      apiKey: 'YOUR_API_KEY',
      clientSecret: 'YOUR_CLIENT_SECRET',
      tenant: 'YOUR_TENANT',
      banknu: 'YOUR_BANKNU',
      env: 'YOUR_ENV'
   }
};

Prefill Cif Code

The Cifcode is the unique customer profile code.

If the Cifcode is empty, a unique code is assigned.

const YOUR_CONFIGURATION = {
   flowType: 'YOUR_FLOW_TYPE',
   credentials: {
      apiKey: 'YOUR_API_KEY',
      clientSecret: 'YOUR_CLIENT_SECRET',
      tenant: 'YOUR_TENANT',
      banknu: 'YOUR_BANKNU',
      env: 'YOUR_ENV'
   },
   // SET THE CIF CODE
   currentUserInfo: {
      cifCode: 'YOUR_CIFCODE'
   },
};

Prefill Desk Verification Enabled

The skipStartPage skips the start page. It's false by default

const YOUR_CONFIGURATION = {
   flowType: 'YOUR_FLOW_TYPE',
   credentials: {
      apiKey: 'YOUR_API_KEY',
      clientSecret: 'YOUR_CLIENT_SECRET',
      tenant: 'YOUR_TENANT',
      banknu: 'YOUR_BANKNU',
      env: 'YOUR_ENV'
   },
   currentUserInfo: {
      cifCode: 'YOUR_CIFCODE'
   },
   // 4. SET SKIP START PAGE ENABLED
   skipStartPage: true
};

Prefill Broker ID

Broker ID to be used in verification.

const YOUR_CONFIGURATION = {
   flowType: 'YOUR_FLOW_TYPE',
   credentials: {
      apiKey: 'YOUR_API_KEY',
      clientSecret: 'YOUR_CLIENT_SECRET',
      tenant: 'YOUR_TENANT',
      banknu: 'YOUR_BANKNU',
      env: 'YOUR_ENV'
   },
   currentUserInfo: {
      cifCode: 'YOUR_CIFCODE'
   },
   skipStartPage: true,
   // SET BROKER ID
   brokerId: 'YOUR_BROKER_ID'
};

Prefill Events

It is an object that allows you to pass some callbacks to handle events of Preventor SDK.

const YOUR_CONFIGURATION = {
   flowType: 'YOUR_FLOW_TYPE',
   credentials: {
      apiKey: 'YOUR_API_KEY',
      clientSecret: 'YOUR_CLIENT_SECRET',
      tenant: 'YOUR_TENANT',
      banknu: 'YOUR_BANKNU',
      env: 'YOUR_ENV'
   },
   currentUserInfo: {
      cifCode: 'YOUR_CIFCODE'
   },
   skipStartPage: true,
   brokerId: 'YOUR_BROKER_ID',
   // SET EVENTS LISTENER
   events: {
      onStart: () => console.log('onStart'),
      onSubmitted: (data) => console.log('onSubmitted', data),
      onFinish: (data) => console.log('onFinish', data),
      onError: code => console.log('onError', code),
   }
};

Handling Verifications

To find out if a user has completed the verification process, canceled it or there was an error. To do this, you can implement the following callback methods:

Codes

Error codes

Disposition status codes

Flow status codes

Last updated