VerifyMe API
Search…
VerifyMe Liveness Widget
VerifyMe has a smooth widget which helps you detect biometric spoofing attacks where a replica or imitation is presented to bypass the required identification and authentication steps

How to Generate Widget

Using the VerifyMe CDN-hosted javascript client library, you can install the Liveness widget into your application. You only have to add the script tag to your html document and insert basic configuration parameters and you'll be good to go.

Step 1: Add the Client Javascript Library

Include the script tag just before the end of the closing body tag of your desired html page where you wish to perform the liveness verification.
1
<script src="https://widget.verifyme.ng/inline.js"></script>
Copied!

Step 2: Configure the Javascript Client Library

At this point, you can now create a Liveness widget object by passing in an object containing public key, product code and other fields containing the verification details.
1
new VerifyMePopupSetup({
2
lastname: "john",
3
firstname: "doe",
4
phone: "08128730170",
5
identityType: "bvn",
6
identityNumber: "10000000001",
7
key: "pk_live_ee7569XXXXXXXXXXXX9884a7cfb435",
8
reference: "<unique_reference>",
9
widgetType: "LIVENESS",
10
productCode: "<your product code>",
11
});
Copied!
key (string, required)
This is the VerifyMe public key, you can find this on the dashboard
widgetType(string, required)
The widgetType property is to signify the widget you're interested in consuming: liveness verification widget (LIVENESS) or express verification (XPRESS). In essence, the property's value could either be LIVENESS OR XPRESS.
productCode (string, required)
This code is uniquely tied to the product created on your account. Kindly reach out to our customer service team to guide you through product creation. PS: It is important to note that you can have multiple products linked to your account.
verification details
These are other details that are required for the liveness check verification: lastname, firstname, phone, identityType, and identityNumber
callback (function, required)
This callback takes one argument, this is called when your user has completed the liveness verification process.
Param
Description
lastname
lastname of the applicant
required
firstname
firstname of the applicant
required
phone
phone no of the applicant
optional
identityType
identity Type (BVN, NIN or FRSC)
required
identityNumber
identity Number
required
reference
unique reference
required
widgetType
LIVENESS or XPRESS
required
productCode
your verifyMe Product code
required

Step 3: Handle a Successful Liveness Verification

On successful verification, the callback function that you supplied is called by the client library with an object as a parameter. The object contains a status field with a success value
1
callback: function (response) {
2
if (response.status == 'success') {
3
// [on success]
4
// Fetch the liveness verification status using the `response.reference` value
5
} else {
6
// [on failed]
7
}
8
}
Copied!
  • Refer to the Requery Liveness Verification section of this documentation. While making this api call, to protect your token key it is advised to make the call from a backend server.
Callback response data
1
// error
2
{
3
'status': 'error',
4
'message': <string>
5
}
6
7
// success
8
{
9
status: 'success',
10
reference: <string>,
11
isLive: <boolean>,
12
match: <boolean>,
13
matchScore: <string>
14
}
Copied!

Liveness Widget Example Script:

liveness_widget.html
1
<html lang="en">
2
3
<head>
4
<meta charset="UTF-8">
5
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6
<title>Liveness Widget Sample Script</title>
7
</head>
8
9
<body>
10
<label>Lastname</label>
11
<input type="text" id="liveness_lastname" />
12
<br>
13
14
<label>Firstname</label>
15
<input type="text" id="liveness_firstname" />
16
<br>
17
18
<label>Phone</label>
19
<input type="text" id="liveness_phone" />
20
<br>
21
22
<label>Select Identity type</label>
23
<select id="liveness_identity_type">
24
<option value="nin" selected="selected"> NIN </option>
25
<option value="bvn"> BVN </option>
26
</select>
27
<br>
28
29
<label>Identity Number</label>
30
<input type="text" id="liveness_identity_number" />
31
<br>
32
<button onclick="launchLiveness(event)">Launch</button>
33
34
<script src="https://widget.verifyme.ng/inline.js"></script>
35
<script type="text/javascript">
36
function launchLiveness(event) {
37
event.preventDefault();
38
39
new VerifyMePopupSetup({
40
lastname: document.getElementById('liveness_lastname').value,
41
firstname: document.getElementById('liveness_firstname').value,
42
phone: document.getElementById('liveness_phone').value,
43
identityType: document.getElementById('liveness_identity_type').value,
44
identityNumber: document.getElementById('liveness_identity_number').value,
45
key: 'pk_live_ee7569XXXXXXXXXXXX9884a7cfb435',
46
widgetType: "LIVENESS | XPRESS",
47
productCode: 'PC',
48
callback: function (response) {
49
if (response.status == 'success') {
50
// on success
51
// Use response.reference to query liveness verification status
52
} else {
53
// on failed
54
}
55
}
56
});
57
58
}
59
</script>
60
</body>
61
62
</html>
Copied!