A unique access token should be created upon each SDK entry. In order to generate an access token, please refer to Valify's Authentication Documentation.
Configurations
The plugin builder is separated into two components.
Required Configurations
Initialize the required parameters as follows while adding the required configurations
Initialize the required parameters as follows while adding the desired configurations
constlanguage="<insert_language>"; // "en" is set as defaultconstdataValidation= <boolean>; // false is set as defaultconst reviewData = <boolean>; // default is trueconst captureOnlyMode = <boolean>; // default is falseconst primaryColor = "<hex_color_code>"; //hexString color const headers = {}; // default is emptyconst enable_logging = <boolean>; // default false const sslCertificate = ""; // certificate, no defaultconst setDocumentVerificationPlus = <boolean> // default is falseconst setCollectUserInfo = <boolean> //default is falseconst setAdvancedConfidence = <boolean> //default is false
Configurations Breakdown
This section shows the breakdown of all optional builder configurations.
The following line is where the user interface language is set.
constlanguage="<insert_language>"; // ["ar" or "en"]
The currently supported languages are Arabic and English
If the following line is set to true, an extra layer of validations is added to the SDK response.
constdataValidation= <boolean>;
If the following line is set to true, a screen is added to the user flow that displays the images captured and the OCR result to the user.
constreviewData= <boolean>;
If the following line is set to true, the SDK purely performs image capturing and only returns these images in the SDK response.
constcaptureOnlyMode= <boolean>;
The following line is optional and can be used to set your company's branding color to the SDK's user interface.
constprimaryColor="<hex_color_code>";
The following line is optional and can be used to set any headers that may be required for purposes specific to your application. Any headers set will be sent along with each API call made by the SDK.
constheaders= {};
The following line is optional and can be used to receive event logs from the SDK experience to be used for user behavior analysis.
constenable_logging= <boolean>;
The following line is optional and can be used to set an SSL certificate that may be required for purposes specific to your application.
constsslCertificate="";
If the following line is set to true, an extra layer of data amd visual validations is added to the SDK response.
constsetDocumentVerificationPlus= <boolean>
If the following line is set to true then additional checks are made for NID fraud detection and the results are returned in the response.
constsetAdvancedConfidence= <boolean>
describtion here (location permission needed for android)
constsetCollectUserInfo= <boolean>
Parameter Declaration
Declare the SDK parameters with the configuration variables previously created
window.VIDVOCRPlugin.startOCR( params, headers, (result) => {console.log('valify success result : ', result);consts=result.toString();constjson=JSON.parse(s);if(json.nameValuePairs.state=="CAPTURED_IMAGES"){// Process is still running, you receive any captured image here }elseif(json.nameValuePairs.state=="EVENT_LOGS"){// Process is still running, you receive here any event during user’s session }elseif(json.nameValuePairs.state=="ERROR_LOGS"){// Process is still running, you receive here any error during user’s session}elseif(json.nameValuePairs.state=="SUCCESS"){// Process finished successfully } }, (error) => {console.log('error in valify', error);consts=error.toString();constjson=JSON.parse(s);if (json.nameValuePairs.state=="EXIT") {// user exits the SDK due to an error occurred } elseif (json.nameValuePairs.state=="ERROR"){ // user exits the SDK due to builder error } } elseif (json.nameValuePairs.state=="FAILURE"){ // user exits the SDK due to service failure } } });