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.
import { createVeriffFrame } from '@veriff/incontext-sdk';
const { createVeriffFrame } = require('@veriff/incontext-sdk');
const veriffFrame = createVeriffFrame({ url: VERIFF_SESSION_URL })
This will render a modal with adapted Veriff application in iframe.
Listening for events
Pass onEvent
callback function when initializing SDK
createVeriffFrame({
url,
onEvent: function(event) {
}
})
event
:
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: VERIFF_SESSION_URL });
API
createVeriffFrame([options])
Create modal with Veriff application.
[options]
- Configuration object.
url
- Veriff session URLonEvent
- 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.