Skip to main content
Use the Youverify Web SDK to let users capture an identity document from inside your web application. The SDK opens a modal, guides the user through capturing the document, and returns the extracted details to your page.

Before you start

You need your Public Merchant Key. You can find it in the API / Webhook section of your Youverify dashboard. It is safe to use in client-side code.
Document Capture on web is initialized with your Public Merchant Key. You don’t need to generate a session ID on your server for this flow. Keep your secret API key on your server and never put it in a web page.

Installation

Integration steps

1

Create the Document Capture module

Pass your options to YouverifySDK.documentCapture:
2

Initialize the module

Call initialize() once. It throws if the options are invalid, so wrap it in a try block.
3

Start the capture flow

Call start() when your user is ready, for example on a button click. This opens the modal.

Options

string
required
Your Public Merchant Key from the API / Webhook section of your dashboard.
boolean
default:"false"
Set to true to run in sandbox mode while you develop and test. Set to false for production.
boolean
default:"false"
Set to true to hide the option to capture the document with a secondary device.
object
User attributes used to personalize the experience.
object
Customize the greeting text, button text and colours. All fields are optional.
array
Limit the capture to specific countries and document types. Each item is an object. All fields are optional.
object
Any other information you want sent to your webhook URL. Use your own keys.
(data) => void
Called when document capture has a result. See Success result.
(error) => void
Called when the result could not be retrieved. Receives an error object.
() => void
Called when the modal is closed.
To see which countries, provinces and document types are supported, see Country and product coverage.

Success result

When capture succeeds, onSuccess receives an object like this:
string
Base64 image of the front of the document.
string
Base64 image of the back of the document.
string
Base64 image of the front of the document. Present when the document has no back to capture.
The result contains personal data and document images. Send it to your backend over HTTPS and don’t write it to logs or store it in the browser.
If you don’t pass an onSuccess callback, nothing happens when capture succeeds.

Close the modal from code

You can close the SDK modal from your own code with setShowModal. It takes a Boolean and returns nothing.

Use it in a mobile app

There is no native mobile SDK for Document Capture yet. To offer it in an Android or iOS app, you can wrap this web integration in a WebView. See Use Document Capture in a mobile app.