1. Allow your site to show the verification
The verification page does not open inside unknown websites. In the dashboard open SDK setup → WebSDK settings and add the address of every site that embeds the verification, for example https://app.example.com.
- The address is exact: scheme, domain and port, no path.
- Only
https://is accepted. - Up to 20 addresses.
The same list lets the verification page use the camera inside your site. If the address is not listed, the frame stays empty.
2. Add the script
Take the files from the web/dist folder of the SDK archive and host them on your site.
<script src="/js/veriffy.js"></script>
<script>
async function verify() {
const { url } = await fetch('/api/kyc/session', { method: 'POST' }).then((r) => r.json());
Veriffy.open({
url,
onComplete: ({ status }) => showThanks(status),
onCancel: () => showRetryButton(),
onError: ({ code }) => (code === 'expired' ? verify() : showError(code)),
});
}
</script>
import Veriffy from './vendor/veriffy.mjs';
const flow = Veriffy.open({
url, // from your server
container: '#kyc', // render inside a block instead of a window
onComplete: ({ status }) => showThanks(status),
});
// later, if you need to close it yourself:
flow.close();
/api/kyc/session in the example is your own server's address that creates the verification and returns the url. How to create a verification is in the quick start.
Options
| Option | Type | Description |
|---|---|---|
url |
string |
Required. The url from the create-verification response |
container |
element or selector | Render the verification inside this block. Give the block a size: the frame fills it |
onComplete |
({status, sessionId, reasons}) |
The verification closed after the user submitted |
onCancel |
({sessionId}) |
The verification closed before submission |
onError |
({code, message, sessionId}) |
The verification closed while an error was on screen |
onEvent |
(event) |
Every verification event: ready, step, submitted, completed, cancelled, error |
title |
string |
The window's name for screen readers. Default Identity verification |
closeLabel |
string |
The close button's label for screen readers. Default Close |
Veriffy.open() returns an object with a close() method. If url is missing or is not an https address, a TypeError is thrown. http://localhost is accepted for development.
Exactly one of onComplete, onCancel and onError is called, exactly once — when the verification closes.
Close the verification as soon as it finishes
On its last screen the verification stays open until the user closes it. To close it straight away:
const flow = Veriffy.open({
url,
onEvent: (e) => { if (e.event === 'completed') flow.close(); },
onComplete: ({ status }) => showThanks(status),
});How the window behaves
- On phones (up to 640 px wide) the verification takes the whole screen; on larger screens it opens a 480 × 760 window.
- The page under the window does not scroll; keyboard focus stays inside the window and returns to where it was after closing.
- A click on the backdrop around the window does nothing: a stray click cannot break a half-finished verification.
- The Esc key closes the window.
If your site has a Content-Security-Policy
Allow the frame with the verification page:
Content-Security-Policy: frame-src https://api.veriffy.meThe SDK adds its styles without inline <style> tags, so a strict style-src does not get in its way.
Isolated pages
If your page sends the Cross-Origin-Embedder-Policy: require-corp header, the verification cannot be embedded. Open the url in a new tab instead.