IdentiCapture - iFrame

Embed IdentiCapture in an iFrame

This section explains how to embed LEM Verify IdentiCapture in an iFrame anywhere to your website.

Step 1 - Add the StartVerification function

Add the StartVerification function in a <script> tag in the <head> tag:

var startVerification = () => {
	const params = {
    	accountId: '<AccountId>',
    	sessionId: '<SessionId>',
    	logoUrl: '<logo URL>',
  		logoHeight: '<Logo Height>px',
   		bgColour: 'ffffff',
    	bgImage: 'none',
    	lang: 'en',
      noBorders: true
  	}
    
	window.onmessage = (event) => {
		console.log(`Event message from iframe: [event code]:${event.data.code} [event name]:${event.data.name}`);
	};
    
	document.getElementById('iframe').src = `https://lemverify.co/?acc=${params.accountId}&sessionId=${params.sessionId}&--img-logo=url(${params.logoUrl})&--img-logo-ht=${params.logoHeight}&--bg-color=${params.bgColour}&--bg-img=${params.bgImage}&locale=${params.lang}&noborders=${params.noBorders}`;
	document.getElementById('iframe').classList.add('iframe')
};

The recommended params for a simple integration are as follows, giving a white background:

const params = {
  accountId: '<AccountId>',
  sessionId: '<SessionId>',
  bgColour: 'ffffff',
  noBorders: true
}

URL Parameters

ParameterRequiredTypeComments
accountIdYes String The AccountId that can be obtained from the Account Settings in your LEM Dashboard.
sessionIdYes String The SessionId obtained via the API for the verification
logoUrlOptionalString The https URL of the logo
logoHeightOptional*String The height value measured in pixels
bgColourOptionalString The background hex colour value, for example a white background would have a value ffffff
bgImageOptionalString The https URL of the background image
langOptionalString Default is en. Acceptable values are:
en
de
fr
pt
it
es
zh
noBordersOptionsBooleanDefault is false.
Set to true if you don't wish to have the shadow border around the iframe.

Event Messages

The event messages are fired through the window.onmessage function. An example of this as follows:

window.onmessage = (event) => {
  console.log(`Event message from iframe: [event code]:${event.data.code} [event name]:${event.data.name}`);
};
EventCodeComments
acceptTerms100Event once the user accepts the Terms & Conditions
selectDocMethod200Event once user selects the Document
selectCountryMethod200Event once user selects the Country of origin for selected Document. Only applies to all documents except for Passports
userCapturedDocumentFrontStart300Event once the document capture process starts for the front document
userCapturedDocumentBackStart300Event once the document capture process starts for the back document
userDocumentFileSendComplete300Event once the document capture process has been completed
livenessStarted400Event once the Liveness process starts
livenessEnded400Event once the Liveness process has been completed
userCapturedSupportDocument500Event once the supporting documents has been uploaded
addressSelect600Event once the address has been selected
finishedAndThanks700Event once the Finish button is pressed

Step 2 - Add the iFrame tag

Add the <iframe> tag to the page where you would like for it to display
NOTE: The attributes of the <iframe> tag is very important

<iframe id="iframe" allow="camera;microphone" src="" title="description"></iframe>

Attributes:
id - the ID of the iFrame, set to iframe
allow - The for the browser to allow camera and microphone permissions
src - The source of the iFrame, set to blank, the source is dynamically created in the previous step

Step 3 - Add the iFrame styling

In a <style> tag, add the following CSS to style the iFrame:

iframe {
    margin: 10px;
    border: none;
    width: 0;
    height: 0;
}

.iframe {
    width: 411px;
    height: 731px;
    border-radius: 20px;
}

Step 4 - Finishing Touches

Once Steps 1 - 3 has been completed, your iFrame should somewhat resemble the image thats shown below:

430