Client Documentation

Dentity verification popup is provided by a single Javascript file. It will add a popup to the DOM. There are some special configurations provided and some functions are used to listen for events that occur during the popup’s lifecycle.

Step 1: Add verify button

Add a button tag or any other tag used to catch the event that calls the popup verification.

<button class="verify" id="selector">Click to verify</button>

Step 2: Add Dentity script

Add a script below to load a single Javascript file. Which is provided to add popups to the DOM. The script should be added at the end of the body tag and the bottom of the selector tag declared at Step 1.

<script src="https://cdn.dentity.com/static/popup/v1/dentity.min.js"></script>

Step 3: Configuration Dentity Popup

Configure Dentity pop-up and handle methods provided by Dentity.

<script>
   window.onload = function () {
     let dentity = new Dentity({
       element: '#selector,
       key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
     });
     dentity.onReady(() => {
       //A function called when the script has loaded and initialized
     });
     dentity.onShow(() => {
       //A function called when the verification popup is displayed
     });
     dentity.onHide(() => {
       //A function called when the verification popup is closed (hidden)
     });
     dentity.onChangeStatus((data) => {
       //A function that is called when the state of verification changes
     });
     dentity.onSubmit((data) => {
       //A function called on pre submit
     });
     dentity.onSubmitted((data, err) => {
       //A function called when submitted
     });
   };
 </script>

This script needs to be added below the script added in Step 2.

Here are two additional mandatory settings:

Option NameDescription

element

(required)

A DOMString containing one or more selectors to match. This string must be a valid CSS selector string; if it isn’t, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more about selectors and how to manage them.

Example: #button-selector

key

(required)

The API key for your domain. You can add a domain on the Dentity business site and get this key. Example: d04c36169f39412696fbf020d793299f1641790047672

Dentity also provides some functions to listen for events during the pop-up’s lifecycle:

Function nameDescription

onReady

A function that is called when the script has been initialized and is ready to be used. You can use it to check if the Dentity popup is ready before allowing the user to display it.

onShow

A function called when the verification popup is displayed.

onHide

A function called when the verification popup is closed.

onChangeStatus

A function called when verification changes status. There are 3 statuses that can be returned: pending, verified, and failed.

onSubmit

A function that is called before sending the data will generate the verification. It will return the data that will be sent.

onSubmited

A function that is called after creating a successful verification. You can call the onChangeStatus function to be able to get the status of that verification after creating it.

Last updated