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
- npm
- yarn
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
Set to
true to run in sandbox mode while you develop and test. Set to false for production.Set to
true to hide the option to capture the document with a secondary device.Limit the capture to specific countries and document types. Each item is an object. All fields are optional.
Called when document capture has a result. See Success result.
Success result
When capture succeeds,onSuccess receives an object like this:
onSuccess callback, nothing happens when capture succeeds.
Close the modal from code
You can close the SDK modal from your own code withsetShowModal. It takes a Boolean and returns nothing.