@veriff/incontext-sdk

In-Context Veriff browser integration

Usage no npm install needed!

<script type="module">
  import veriffIncontextSdk from 'https://cdn.skypack.dev/@veriff/incontext-sdk';
</script>

README

Installation

npm install @veriff/incontext-sdk

Usage

You need to have a Veriff session URL generated before initializing the SDK. Please, see our documentation to learn how to generate one.

// ES6
import { createVeriffFrame } from '@veriff/incontext-sdk';

// CommonJS
const { createVeriffFrame } = require('@veriff/incontext-sdk');

const veriffFrame = createVeriffFrame({ url: 'session url' })

This will render a modal with adapted Veriff application in iframe.

Listening for events

Pass onEvent callback function when initializing SDK

import { createVeriffFrame, MESSAGES } from '@veriff/incontext-sdk';

createVeriffFrame({
  url: 'session url',
  onEvent: function(msg) {
    switch(msg) {
      case MESSAGES.CANCELED:
        //
        break;
    }
  }
})
  • msg:
    • STARTED - session status changed to 'started'.
    • CANCELED - user closed the modal.
    • FINISHED - user finished verification flow.

Using with inline script

Include a script tag:

<script src='https://cdn.veriff.me/incontext/js/v1/veriff.js'></script>
window.veriffSDK.createVeriffFrame({ url: 'session url' });

API

createVeriffFrame([options])

Create modal with Veriff application.

  • [options] - Configuration object.
    • url - Veriff session URL
    • lang - Set user interface language
    • onEvent - Event callback function

Returns an object that controls the modal.

.close()

Close Veriff modal. Normally modal will be closed due to user input, but if you want to control it(e.g. timeout), please use this function.