SDK Methods
create​
Description:
You need to call this method before using the SDK. The method returns an instance of the SDK.
Parameters:
Name | Type | Description |
---|---|---|
apiKey | string | API key |
apiURL | string | API URL |
lang | string | Language (en or es) |
encrypt | boolean | Indicates the use of encryption (default: false) |
translations | object | The object with the translations. (Ask support) (optional) |
opencvURL | string | The URL of opencv (optional) |
facefinderURL | boolean | The URL of facefinder (optional) |
darkMode | boolean | Show dark variants of all tutorials (default: false) |
fingerprintApiKey | string | The fingerprint API key (optional). |
Returns
Object:
The SDK instance
Example:
// Get onBoarding instance
const onBoarding = OnBoarding.create({
apiKey: "myApiKey",
apiURL: "myApiURL",
lang: "en",
});
// You can save it on a global variable
var onBoarding = OnBoarding.create({ apiKey: "myApiKey", apiURL: "myApiURL" });
// use the instance
onBoarding.createSession(countryCode).then((token) => {
// save token
});
createSession​
Description:
Initializes new onboarding session.
Parameters:
Name | Type | Description |
---|---|---|
countryCode | string | it can be 'US' OR 'MX'. |
externalId | string (optional) | Any ID |
optionsObject | object (optional) | Check Options seccions |
Options:
Name | Type | Description |
---|---|---|
interviewId | string | The interviewId for another session. If you send this paramameter you are not going to create a new session. It will use the one in interviewId. |
configurationId | string | The flow (configuration) ID. If you send this paramameter the thresholds, checks, autoapprove, etc. of the flow will be used. |
customFields | object | The object containing the customField |
Returns:
The access token
Object:
JSON object
Example:
// Get token
onBoarding.createSession(countryCode).then(token => {
// save token
...
});
Or with an async function
// Get session
const session = await onBoarding.createSession(countryCode);
const token = session.token;
const interviewId = session.interviewId;
With an interviewId
const session = await onBoarding.createSession("MX", null, {
interviewId: "5ec49fd49999999999999f1e",
});
isDesktop​
Description:
This function informs you if the user is using a desktop computer (it can be a laptop)
Example:
if (onBoarding.isDesktop()) {
onBoarding.renderRedirectToMobile(containerRef.current, {
onSuccess: () => {
renderFinishScreen();
},
session: session,
flowId: flowId,
});
} else {
// show mobile normal flow
renderFrontId();
}
renderRedirectToMobile​
Description:
This method renders the Redirect Component
Parameters:
Name | Type | Description |
---|---|---|
container | HTMLElement | |
options Object | object | options object |
Options:
Name | Type | Description |
---|---|---|
session | object* | The session object you get in createSession (Mandatory) |
flowId | string | ID of the flow that will be used in the mobile |
onSuccess | function* | Callback when the onboarding in mobile was successful and completed |
url | string | URL to be redirected to |
showSms | boolean | Boolean flag indicating if the SMS component should be shown |
allowReEnrollment | boolean | Boolean flag indicating if user re-enrollment is allowed |
externalId | string | External ID to concatenate to URL if needed |
assets | object | Object containing assets from the dashboard |
expired | boolean | Boolean flag indicating if a session is expired |
smsText | string | Custom text to be send in SMS. The URL is concatenated after this text |
Example:
const flowId = "someflowid";
const session = await onBoarding.createSession("ALL", null, {
configurationId: flowId,
});
if (onBoarding.isDesktop()) {
onBoarding.renderRedirectToMobile(containerRef.current, {
onSuccess: () => {
renderFinishScreen();
},
session: session,
flowId: flowId,
});
} else {
// show mobile normal flow
renderFrontId();
}
renderQr​
Description:
This method renders a Qr code which when scanned will open a specified URL or web flow application.
Parameters:
Name | Type | Description |
---|---|---|
container | HTMLElement | |
options Object | object | options object |
Options:
Name | Type | Description |
---|---|---|
session | object* | The session object you get in createSession (Mandatory) |
flowId | string | ID of the flow that will be used in the mobile |
onSuccess | function* | Callback when the onboarding in mobile was successful and completed |
url | string | URL to be redirected to |
primaryColor | string | A hexcode string for styling, ie #000000 |
secondaryColor | boolean | A hexcode string for styling, ie #FFFFFF |
sizePx | number | A single number representing width and height in pixels |
Example:
const flowId = "someflowid";
const session = await onBoarding.createSession("ALL", null, {
configurationId: flowId,
});
if (onBoarding.isDesktop()) {
onBoarding.renderQr(containerRef.current, {
onSuccess: () => {
showFinishScreen();
},
session: session,
flowId: flowId,
});
} else {
// show mobile normal flow
renderFrontId();
}
sendGeolocation​
Description:
This is almost the same as addGeolocation
with the difference being that this will automatically ask the user for the coordinates.
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token to be used in all other methods. |
Returns:
Object:
JSON object
JSON example:
{
"location": "Belgrade, Serbia"
}
Example:
onBoarding.sendGeolocation({ token }).then((res) => res);
renderCamera​
Description:
This method is going to render the camera with the autodetect and notifications in the browser.
Parameters:
Name | Type | Description | |||||||
---|---|---|---|---|---|---|---|---|---|
type | string | type of captured image: `'front' | 'back' | 'selfie | document | passport | secondId | thirdId | insuranceCard'` |
container | HTMLElement | ||||||||
optionsObject | object | options object |
Options:
Name | Type | Description |
---|---|---|
onSuccess | function | Callback when the detect was successful, with param object |
onError | function | Callback when the detect was unsuccessful |
token | Object | The session object (optional if not presented is readed from state) |
numberOfTries | Number | The number of capturing attempts |
onLog | function | A function with a logger |
permissionMessage | String | The message in the permission screen. Default: "Press \"Allow\" to continue." |
permissionBackgroundColor | String | The background of permissions screen. Default: "#696969 |
sendBase64 | boolean | If you need to send the image in base64, set this to true (only if type = 'selfie' ) |
timeout | number | The timeout in milliseconds for looking for a face (only if type = 'selfie' ) |
showPreview | boolean | Set to true to show capture preview. (only if type = 'selfie' ) |
stream | MediaStream | If you send a stream, it won't ask the user again. This is an advanced option. |
nativeCamera | boolean | This is only optional for documents. If set to true, it's going to use the native camera for the capture (default: false) |
showTutorial | boolean | Option to show the tutorial (default: false) |
isRecordingEnabled | boolean | Option to record the capture camera (default: false) |
onRestartOnboarding | function | Callback for the restart flow after camera access is denied (default: () => window.location.reload() ) |
showDoublePermissionsRequest | boolean | Option to show the custom permission prompt (default: false) |
onlyAllowCapture | boolean | Option to disable the uploading of files and images. Only works when the type is document and nativeCamera is set to true (default: false ) |
disableFullScreen | boolean | Option to disable the full screen behaviour our SDK has. This will use the container width and height. Use this only for Desktop apps. (default:false ) |
showCustomCameraPermissionScreen | boolean | Option to open a modal with instructions to allow camera permissions when user denies them. (default:false ) |
onSuccess parameters:
Name | Type | Description |
---|---|---|
classification | Boolean | Is server classified image as a Id flag |
correctGlare | Boolean | Is the glare in good range flag |
correctSharpness | Boolean | Is the sharpness in the good range flag |
countryCode | String | Valid ISO alpha-2 or alpha-3 code of the ID issuing country |
glare | Number | Glare level |
horizontalResolution | Number | Horizontal resolution in pixels |
issueName | String | Name of provided ID |
issueYear | Number | The year when the ID was issued |
readability | Boolean | Is the data readable from the ID flag |
sessionStatus | String | Current status of the session |
sharpness | Number | Sharpness level |
skipBackIdCapture | Boolean | Flag for skipping back ID capture |
typeOfId | String | Type of ID (ID, Passport...) |
failedReason | String | Classification fail reason. |
Returns:
Object:
JSON object
Name Type Description close function This will close the camera and will unmount the component
Example:
const { close } = incode.renderCamera("front", container, {
onSuccess: onSuccess,
onError: onError,
});
// then you can close the SDK from your code
document.querySelector("#close-modal").addEventListener("click", () => {
close(); // this will close the component prematurely, so use it only if you want to abort the process and close the camera
});
processId​
Description:
This method should be called once the uploads of the front and back sides of the ID are over. Incode validations, tests and OCR parsing are processed during this method. To fetch OCR data, use the ocrData method. Parameter queueName is needed so it can be determined in which queue the interview should go. Once this is called, the user is no longer able to upload the ID (front, back side, passport or insurance card)!
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token. |
Returns:
Object:
JSON object
JSON example:
{
"success": true
}
Example:
const response = await onBoarding.processId({
token,
});
processFace​
This method should be called after both the selfie and the front of the ID are uploaded. (/omni/add/face and /omni/add/front-id). The response contains information if this user already exists in the system and there is recognition confidence between the selfie image and the face image from the front of the ID. In order to get face images, the method /omni/get/images should be called.
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token. |
Returns:
Object:
JSON object
Parameters:
Name Type Description confidence number float number 0 - 1 indicating recognition confidence existingUser boolean indicates if the user has already been enrolled JSON example:
{
"confidence": 0.794,
"existingUser": false
}
Example:
const response = await onBoarding.processFace({
token,
});
renderFaceMatch​
Description:
This method renders the component that shows the face match animation.
Parameters:
Name | Type | Description |
---|---|---|
container | HTMLElement | |
options Object | object | options object |
Options:
Name | Type | Description |
---|---|---|
token | String | The session object |
onSuccess | function | Callback when the face match animation is finish |
liveness | boolean | If the liveness passed or not. You will get in the onSuccess callback from renderCamera('selfie', ...) |
existingUser | boolean | If the user is already in our database. You will get in the onSuccess callback from renderCamera('selfie', ...) |
Example:
incode.renderFaceMatch(document.getElementById("app"), {
token: session,
onSuccess: console.log,
onError: console.log,
liveness: liveness,
existingUser: existingUser,
});
renderMlConsent​
Description:
This method will render the ML Consent component.
Parameters:
Name | Type | Description |
---|---|---|
container | HTMLElement | |
options Object | object | options object |
Options:
Name | Type | Description |
---|---|---|
token | object | The token object (mandatory). |
type | string | ML Type (Worldwide) |
onSuccess | function | Callback when the upload of signature was successful |
Example:
onBoarding.renderMlConsent(document.getElementById("app"), {
token: session,
onSuccess() {
console.log("ML accepted");
},
});
renderQrScanner​
Description:
This method will render the QR Scanner component.
Parameters:
Name | Type | Description |
---|---|---|
container | HTMLElement | |
options Object | object | options object |
Options:
Name | Type | Description |
---|---|---|
session | object | The session object (mandatory). |
onSuccess | function | Callback when the upload of signature was successful |
Example:
onBoarding.renderQrScanner(document.getElementById("app"), {
session: session,
onSuccess() {
console.log("QR scanned");
},
});
renderEnterCurp​
Description:
This method renders the component to enter and validate CURP.
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token to be used in all other methods. |
Example:
incode.renderEnterCurp(document.getElementById('app'), {
token: session.token,
onSuccess: console.log,
onError: console.log,,
})
processGovernmentValidation​
Description:
This method should be called after both /omni/process/id (or /omni/add/document-id) and /omni/add/face are over. This method compares the user's selfie image against the image in the INE database.
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token. |
Returns:
Object:
JSON object
JSON example:
{
"success": true
}
renderSignature​
Description:
This method will render the Signature Component.
Parameters:
Name | Type | Description |
---|---|---|
container | HTMLElement | |
options Object | object | options object |
Options:
Name | Type | Description |
---|---|---|
token | String | The token string (Mandatory) |
onSuccess | function | Callback when the upload of signature was successful |
onError | function | Callback when the upload of signature was unsuccessful |
type | string | Type of signature. This can be used for sign contracts |
initials | boolean | If true, this will send initials and not signature |
title | jsx | The title element in JSX syntax |
subtitle | jsx | The subtitle element in JSX syntax |
canvasBackgroundColor | string | The background color of the canvas (default: '#fff') |
canvasBorderColor | string | The border color of the canvas (default: '#20263d') |
penColor | string | The pen color of the canvas (default: '#20263d') |
Example:
onBoarding.renderSignature(document.getElementById("app"), {
token: session.token,
onSuccess: console.log,
onError: console.log,
});
addDocument​
Description:
Upload document image and store data.
Parameters:
Name | Type | Description |
---|---|---|
token | string | The session object. |
type | string | Possible values: signature, document, medicalDoc, thirdId, contract |
image | string | Image of a document represented in base64. |
Returns:
Object:
JSON object
`Parameters:
Name Type Description success boolean If the call was called correctly. additionalInformation object Info about the signed contract
- additionalInformation:
Name | Type | Description |
---|---|---|
contractId | string | Used later when adding signature to contract. |
JSON example:
{
"success": true,
"additionalInformation": {
"contractId": "cf2ec1fd-bf20-4885-b748-d7e761592d19"
}
}
Example:
incode.addDocument({
token,
type: "contract",
image: contractBase64,
});
attachSignatureOnAnnotation​
Description:
Signature from interview to previously uploaded PDF contracts at all places annotated with text from request, with desired height on the PDF. Annotations must contain text with either preselected values, or an alternative can be supplied. Preselected values are: INITIALS, PATIENTS_SIGNATURE, NON_MEDICAL_SIGNATURE_1, NON_MEDICAL_SIGNATURE_2, MEDICAL_SIGNATURE_1, MEDICAL_SIGNATURE_2. The endpoint is intended to be used as a fluent method. One call to the method responds by giving the ID of the signed document which can then be used in the subsequent call to continuously add another signature on a different annotation.
Parameters:
Name | Type | Description |
---|---|---|
token | string | The session object. |
contractId | string (optional) | IDs of previously added contract (Check addDocument) |
signatureType | string (optional) | One of the preselected values for annotation text |
signedContractId | string (optional) | IDs of previously signed contract (ID is returned as response from the previous attachSignatureOnAnnotation) |
Returns:
Object:
JSON object
`Parameters:
Name Type Description success boolean If the call was called correctly. additionalInformation object Info about the signed contract
- additionalInformation:
Name | Type | Description |
---|---|---|
signedDocumentId | string | New signed document ID |
signedDocumentURL | string | Temporary URL to new signed document |
JSON example:
{
"success": true,
"additionalInformation": {
"signedDocumentId": "new signed document ID",
"signedDocumentURL": "temporary URL to new signed document"
}
}
Example:
incode.attachSignatureOnAnnotation({
contractId: "somecontractid",
signatureType: "PATIENTS_SIGNATURE",
token: session.token,
signedContractId: "someSignedContractId",
});
renderVideoSelfie​
Description:
This method renders the VideoSelfie Component
Parameters:
Name | Type | Description |
---|---|---|
container | HTMLElement | |
options Object | object | options object |
callback Object | object | options object |
Options:
Name | Type | Description |
---|---|---|
token | String | The token string (Mandatory) |
showTutorial | boolean | Option to show the tutorial (default: false) |
modules | Array[String] | The modules you want to perform in video selfie. Check the table to see all available modules (The default is all modules) |
speechToTextCheck | boolean | Option to perform the speech to text check. If this is false, the videoSelfie always will call onSuccess (default: true) |
performLiveness | boolean | Off/On liveness check, by default it is false |
videoSelfieAsSelfie | boolean | The option to choose from which image you will make a face check, from selfie or video selfie. If it is true it will be from selfie |
compareOCREnabled | boolean | Option to off/on front OCR check (default: false) |
compareIDEnabled | boolean | Option to off/on front ID check (default: true) |
compareBackOCREnabled | boolean | Option to off/on back OCR check (default: false) |
compareBackIDEnabled | boolean | Option to off/on back ID check (default: false) |
questionsCount | Number | Option to set number of questions in questions module (default: 3) |
Modules
Name | Description |
---|---|
selfie | Selfie step |
front | Front ID step |
back | Back ID step |
poa | Proof of address step |
questions | Random questions step |
speech | The user will perform an authorization. Important: this step is mandatory and needs to be the last one |
Callback
Name | Type | Description |
---|---|---|
onSuccess | function | Callback when the videoselfue was successful. If this is called it means the speech detection was successful. |
onError | function | Callback when the detect was unsuccessful. If this is called it means the speech detection was unsuccessful |
numberOfTries | number | The number of tries in speech-to-text |
Example:
onBoarding.renderVideoSelfie(
container,
{
token: session,
showTutorial: true,
modules: ["selfie", "front", "back", "speech"], // you can add 'poa' and 'questions'
speechToTextCheck: true, // this is the check for the speech
},
{
onSuccess: () => alert("speech detected"),
onError: () => alert("speech not detected"),
numberOfTries: 3,
}
);
renderConference​
Description:
This method will render the Conference component
Parameters:
Name | Type | Description |
---|---|---|
container | HTMLElement | |
options Object | object | options object |
callback Object | object | callbacks object |
Options:
Name | Type | Description |
---|---|---|
token | Object | The session object (Mandatory) |
showOTP | Boolean | If true, it will render the OTP screen before conference |
numberOfTries | Number | The number of tries that the user has for OTP. If you put -1 the user will have infinite tries. Default: 3 |
queue | String | The queue for the video conference. Default: '' |
Callbacks:
Name | Type | Description |
---|---|---|
onSuccess | function | Passes the status as a parameter. Possible statuses are: close, deny, approve |
onError | function | Callback when the detect was unsuccessful. Something went wrong in the conference |
onConnect | function | Callback when the conference is connected |
onLog | function | Callback for the logging |
Example:
onBoarding.renderConference(
container,
{
token: token,
showOTP: false,
},
{
onSuccess: (status) => {
log(status);
switch (status) {
case "close":
console.log("The conference was close");
goToStep("closeCase");
break;
case "deny":
console.log("The conference was denied");
goToStep("denyCase");
break;
case "close":
console.log("The conference was approved");
goToStep("approveCase");
break;
}
},
}
);
getFinishStatus​
Description:
This method is called after you finish the onboarding process but only if you are using custom flows. It is required for self configurations, like autoapprove, to function properly.
Parameters:
Name | Type | Description |
---|---|---|
flowId | string | The ID of the flow you put in createSession (optional, can be null) |
token | string | The token obtained from createSession. |
Returns:
Object:
JSON object
Properties:
Name Type Description redirectionUrl string Url to be redirected when onboarding is done action string Possible values: none
|approved
|manualReview
|rejected
. Refers to the action performed based on the flow score configurations if applicable.JSON example:
{
"action": "none",
"redirectionUrl": ""
}
Example:
// first you call createSession with the flow id you want to use in the onboarding. (It's called configurationId in the createSession method)
const flowId = 'someFlowId'
const { token } = incode.createSession(code, undefined, {
configurationId: flowId,
})
...
// Call SDK methods to finish the onboarding process
...
// then you call getFinishStatus with the session object and the flowId (flowId is optional here)
incode.getFinishStatus(flowId, { token });
getScore​
Description:
Get ID validation, liveness and face recognition results for given interviewId.
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token. |
Returns:
- Object: JSON object
JSON example:
{
"idValidation": {
"photoSecurityAndQuality": [
{
"value": "PASSED",
"status": "OK",
"key": "incodeTamperCheck"
},
{
"value": "PASSED",
"status": "OK",
"key": "incodeFakeCheck"
},
{
"value": "PASSED",
"status": "OK",
"key": "incodeIdLiveness"
},
{
"value": "PASSED",
"status": "OK",
"key": "qrCheck"
},
{
"value": "PASSED",
"status": "OK",
"key": "issueDateCheck"
},
{
"value": "100",
"status": "OK",
"key": "balancedLightFront"
},
{
"value": "100",
"status": "OK",
"key": "balancedLightBack"
},
{
"value": "59",
"status": "OK",
"key": "sharpnessFront"
},
{
"value": "67",
"status": "OK",
"key": "sharpnessBack"
},
{
"value": "100.0",
"status": "OK",
"key": "readabilityCheck"
},
{
"value": "79",
"status": "WARN",
"key": "incodeCrossCheck"
}
],
"idSpecific": [
{
"value": "50",
"status": "WARN",
"key": "2DBarcodeRead"
},
{
"value": "100",
"status": "OK",
"key": "birthDateValid"
},
{
"value": "100",
"status": "OK",
"key": "compositeCheckDigit"
},
{
"value": "100",
"status": "OK",
"key": "documentClassification"
},
{
"value": "100",
"status": "OK",
"key": "documentExpired"
},
{
"value": "100",
"status": "OK",
"key": "documentNumberCheckDigit"
},
{
"value": "100",
"status": "OK",
"key": "expirationDateCrosscheck"
},
{
"value": "100",
"status": "OK",
"key": "expirationDateValid"
},
{
"value": "50",
"status": "WARN",
"key": "fullNameCrosscheck"
},
{
"value": "100",
"status": "OK",
"key": "imageTamperingCheck"
},
{
"value": "100",
"status": "OK",
"key": "issueDateValid"
},
{
"value": "100",
"status": "OK",
"key": "issuingStateValid"
},
{
"value": "100",
"status": "OK",
"key": "visiblePattern"
},
{
"value": "100",
"status": "OK",
"key": "visiblePhotoCharacteristics"
}
],
"overall": {
"value": "76.0",
"status": "OK"
}
},
"liveness": {
"livenessScore": {
"value": "98.9%",
"status": "OK"
},
"photoQuality": {
"value": "116.9"
},
"overall": {
"value": "98.9",
"status": "OK"
}
},
"faceRecognition": {
"existingUser": true,
"overall": {
"value": "88.4",
"status": "OK"
}
},
"governmentValidation": {
"recognitionConfidence": {
"value": "81.3",
"status": "OK"
},
"validationStatus": {
"value": "0",
"status": "OK",
"key": "ok"
},
"ocrValidation": [
{
"value": "true",
"status": "OK",
"key": "issueDate"
},
{
"value": "true",
"status": "OK",
"key": "firstName"
},
{
"value": "true",
"status": "OK",
"key": "maternalLastName"
},
{
"value": "true",
"status": "OK",
"key": "paternalLastName"
},
{
"value": "true",
"status": "OK",
"key": "ocr"
},
{
"value": "true",
"status": "OK",
"key": "personalId"
},
{
"value": "true",
"status": "OK",
"key": "electorsKey"
},
{
"value": "true",
"status": "OK",
"key": "emissionNumber"
},
{
"value": "true",
"status": "OK",
"key": "registrationDate"
}
],
"overall": {
"value": "81.3",
"status": "OK"
}
},
"overall": {
"value": "86.2",
"status": "OK"
}
}
Example:
// Get score
const score = await onBoarding.getScore({ token });
ocrData​
Description:
Fetch OCR data
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token. |
Returns:
Object:
JSON object
Parameters:
Name Type Description birthDate string timestamp of birthday. name string user full name. address string address. gender string user gender. typeOfId string type of ID ... ... ... JSON example (actual data returned depends on id type):
{
"_id": "5e0b133d8c00860016e7e8db",
"_createdAt": 1577784125675,
"_updatedAt": 1577784125675,
"apiKey": "abcde12345",
"name": "DIEGO MONDRAGON OCARANZA",
"phone": "+381605211222",
"birthDate": "632966400000",
"address": "COL PEDREGAL DE SAN ANGEL 01900\nALVARO OBREGON ,D.F.",
"gender": "M",
"typeOfId": "INE",
"countryCode": "MEX",
"cic": "114988030",
"numeroEmisionCredencial": "01",
"tamperedConfidence": 0.17613846,
"idValidationScore": "Attention",
"fakeIdConfidence": 0.9999198,
"paperFrontConfidence": 0.0,
"screenFrontConfidence": 1.7501973e-6,
"paperBackConfidence": 0.0,
"screenBackConfidence": 3.5412256e-7,
"retouchFrontConfidence": 0.004690816,
"classification": 14,
"frontSharpness": 59,
"frontGlare": 100,
"frontShadowConfidence": 0.8312062,
"backSharpness": 67,
"backGlare": 100,
"backShadowConfidence": 0.6933477,
"issueDate": 2014,
"expirationDate": 2024,
"croppedIDFaceRef": "5e0b26528c00860016e7e8fa",
"fullFrameFrontIDRef": "5e0b26528c00860016e7e8fb",
"fullFrameBackIDRef": "5e0b26dc8cdb170011c6e705",
"frontIdProcessed": true,
"backIdProcessed": true,
"idValidationFinished": true,
"paternalLastNameValid": true,
"maternalLastNameValid": false,
"nameValid": true,
"curpValid": true,
"ocrValid": true,
"claveDeElectorValid": true,
"numeroEmisionCredencialValid": true,
"registrationDateValid": true,
"issueDateValid": true
}Insurance card JSON example (actual data returned depends on insurance card type):
{
"_id": "5e0b133d8c00860016e7e8db",
"_createdAt": 1577784125675,
"_updatedAt": 1577784125675,
"apiKey": "abcde12345",
"name": "John Smith",
"cardId": "114988030",
"phone": "+14535634564",
"email": "john.smith@outlook.com",
"birthDate": "632966400000",
"groupNumber": "154",
"groupName": "Group A",
"address": "725 5th Ave, New York, NY 10022",
"gender": "M",
"typeOfId": "AdultCare",
"employer": "Walmart",
"payerID": "8739",
"countryCode": "US",
"issueNumber": "01",
"tamperedConfidence": 0.17613846,
"idValidationScore": "Attention",
"fakeIdConfidence": 0.9999198,
"paperFrontConfidence": 0.0,
"screenFrontConfidence": 1.7501973e-6,
"paperBackConfidence": 0.0,
"screenBackConfidence": 3.5412256e-7,
"retouchFrontConfidence": 0.004690816,
"classification": 14,
"frontSharpness": 59,
"frontGlare": 100,
"frontShadowConfidence": 0.8312062,
"backSharpness": 67,
"backGlare": 100,
"backShadowConfidence": 0.6933477,
"issueDate": 2014,
"expirationDate": 2024,
"croppedIDFaceRef": "5e0b26528c00860016e7e8fa",
"fullFrameFrontIDRef": "5e0b26528c00860016e7e8fb",
"fullFrameBackIDRef": "5e0b26dc8cdb170011c6e705",
"frontIdProcessed": true,
"backIdProcessed": true,
"idValidationFinished": true,
"paternalLastNameValid": true,
"maternalLastNameValid": false,
"nameValid": true,
"cardValid": true,
"ocrValid": true,
"issueDateValid": true,
"expirationDateValid": true
}
Example:
// get ocr data from the ID
const ocrData = await onBoarding.ocrData({ token })
const { birthDate, name, address, gender, ... } = ocrData
getImages​
Description:
Returns images for the user. The values from the images that can be returned: selfie, croppedFace, croppedIDFace, document, signature, fullFrameFrontID, fullFrameBackID, croppedFrontID, croppedBackID.
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token. |
body | Object | Check body object table and example |
Body:
Name | Type | Description |
---|---|---|
images | Array of Strings | Needs to be an array with one or more of the following: selfie, croppedFace, croppedIDFace, document, signature, fullFrameFrontID, fullFrameBackID, croppedFrontID, croppedBackID |
Returns:
- Object: JSON object
JSON example:
{
"croppedFace": "iVBORw0KGgoAAAANSUhEUgAAAaQAAAGkCAIAAADxLsZ....",
"croppedIDFace": "iVBORw0KGgoAAAANSUhEUgAAAaQAAAGkCAIAAADxLsZ..."
}
Example:
// Get images
const images await onBoarding.getImages({
token: sessionToken,
body: { images: ['croppedIDFace', 'selfie'] },
})
approve​
Description:
Approve a customer.
Parameters
Name | Type | Description |
---|---|---|
token | string | access token to be used in all other methods. |
Returns:
Object:
JSON object
JSON example:
{
"success": true,
"customerId": "incode",
"token": "token"
}
Example:
onBoarding.approve({ token }).then({customerId} => {
console.log(customerId,':)')
...
});
renderLogin​
Description:
This method renders the Face Login Component
Parameters:
Name | Type | Description |
---|---|---|
element | Element | The DOM element where the login component will be rendered. |
onSuccess | function | Callback when the detect was successful. |
onError | function | Callback when an error happened. |
timeout | number (optional) | Maximum time allowed for the login process, after which the onError callback is triggered. |
stopAtAccessDenied | boolean (optional) | Flag to trigger onError callback when access denied event happened. |
stopAtError | boolean (optional) | Flag to trigger onError callback when any error event happened. |
isOneToOne | boolean (optional) | Specifies if the login is for a one-to-one session.If true you will need to send oneToOneProps |
oneToOneProps | Object (optional) | Object containing additional properties for one-to-one sessions. |
oneToOneProps.phone | string (optional) | Phone number to use for one-to-one session authentication. |
oneToOneProps.identityId | string (optional) | Identity ID for the user in one-to-one sessions. (Client Id) |
oneToOneProps.email | string (optional) | Email address to use for one-to-one session authentication. |
showCustomCameraPermissionScreen | boolean (optional) | Whether to show a custom camera permission screen instead of the default browser prompt. |
isKiosk | boolean (optional) | Indicates if the login is being used in a kiosk mode. |
Example:
incode.renderLogin(container, {
onSuccess: onSuccess,
onError: onError,
});
publishKeys​
Description:
Send encryption information that will be sent in every intercepted call.
Parameters:
Name | Type | Description |
---|---|---|
token | string | Citi side generated token. |
Returns:
Object:
JSON object
JSON example:
{
"success": true
}
Example:
onBoarding.publishKeys(token);
sendFingerprint​
Description:
Sends relevant information about the user's device and Incode's Web SDK:
- Browser version
- Device model
- Application type (Web application)
- OS and OS version
- Incode's Web SDK version
- User's IP address
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token to be used in all other methods. |
Returns:
- Object:
{
"success": boolean,
"sessionStatus": string
}
Example:
onBoarding.sendFingerprint({ token: session.token }).then((response) => {
console.log(response.success);
});
addPhone​
Description:
Add phone number to an interview. If a customer with that phone number already exists, an error will be thrown.
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token to be used in all other methods. |
phone | string | customer's phone number |
Returns:
Object:
JSON object
JSON example:
{
"success": true
}
Example:
onBoarding.addPhone({ token, phone }).then((res) => res);
Example:
const response = await onBoarding.processGovernmentValidation({
token,
});
getCustomFields​
Description:
This method is used for fetching custom fields for the current session.
Parameters:
Name | Type | Description |
---|---|---|
token | string | The session object. |
Returns:
Object:
JSON object
`Parameters:
Name Type Description customFields object Object of custom fields with type that was inserted.
JSON example:
{ "customFields": { "watchlistName": "John Smith" } }
Example:
incode.getCustomFields({
token: session.token,
});
addCustomFields​
Description:
This endpoint is used for adding custom fields to current onboarding session.
Parameters:
Name | Type | Description |
---|---|---|
token | string | access token to be used in all other methods. |
fields | object | Object of custom fields that will be inserted. |
Returns:
Object:
JSON object
`Parameters:
Name Type Description success boolean If the call was called correctly.
- JSON example:
{
"success": true
}
Example:
incode.addCustomFields({
token: session.token,
fields: { watchlistName: name },
});
renderDocumentSelector​
Description:
This method renders a Document Selector in a given container. It provides various customization options and callbacks for different stages of the document selection process. It accepts the same parameters as renderCamera
, excluding type
.
Parameters:
Name | Type | Description |
---|---|---|
element | React.ReactNode | Element | The container element or node where the document selector will be rendered. |
options | RenderCameraProps object | Configuration options for the document selector. |
Options:
Name | Type | Default | Description |
---|---|---|---|
onSuccess | function | emptyFunc | Callback when the document selection is successful. |
onError | function | emptyFunc | Callback when there is an error in the document selection process. |
numberOfTries | number | 3 | The number of attempts allowed for document selection. |
onLog | function | emptyFunc | A function for logging. |
permissionMessage | string | The message shown in the permission screen. | |
permissionBackgroundColor | string | The background color of the permission screen. | |
token | object | The session token. | |
timeout | number | 40000 | The timeout duration in milliseconds. |
sendBase64 | boolean | true | Flag to determine if the image should be sent in base64 format. |
documentType | string | The type of document to be selected. | |
showPreview | boolean | false | Flag to show preview after document capture. |
stream | MediaStream | A media stream object. | |
nativeCamera | boolean | false | Flag to use the native camera for capture. |
hideRetake | boolean | false | Flag to hide the retake option. |
showTutorial | boolean | false | Flag to show a tutorial. |
showPaperDLTutorial | boolean | false | Flag to show a paper driver's license tutorial. |
onlyCapture | boolean | false | Flag to allow only capturing of images/documents. |
scanPdf417 | boolean | false | Flag to scan for PDF417 barcodes. |
videoTutorialSrc | string | Source of the video tutorial. | |
showCustomCameraPermissionScreen | boolean | false | Flag to show a custom camera permission screen. |
isSecondId | boolean | false | Flag to indicate if the document is a second ID. |
fullScreen | boolean | true | Flag to enable full-screen mode. |
assistedOnboarding | boolean | false | Flag to enable assisted onboarding. |
isRecordingEnabled | boolean | false | Flag to enable recording during capture. |
onRestartOnboarding | function | reload | Callback to restart the onboarding process. |
showDoublePermissionsRequest | boolean | false | Flag to show a double permissions request. |
onlyAllowCapture | boolean | false | Flag to allow only capture (disables uploading of files/images). |
disableFullScreen | boolean | false | Flag to disable full-screen behavior (uses container width/height). |
onStreamReady | function | emptyFunc | Callback when the stream is ready. |
showAutoCaptureIDOverlay | boolean | false | Flag to show an automatic capture ID overlay. |
showManualCaptureIDOverlay | boolean | false | Flag to show a manual capture ID overlay. |
skipProcessFace | boolean | false | Flag to skip processing of the face in the document. |
defaultHorizontalMask | boolean | false | Flag to use a default horizontal mask for the capture. |
isFixedMask | boolean | false | Flag to indicate if the mask is fixed. |
blurrinessStrictMode | boolean | false | Flag to enable strict mode for blurriness detection. |
Usage Example:
const element = document.getElementById("your-container-id");
const onSuccess = () => {
/* success handler code */
};
const onError = () => {
/* error handler code */
};
renderDocumentSelector(element, {
onSuccess,
onError,
// ...other options
});
renderBiometricConsent​
Description:
This method renders the component with biometric consent screen. It should be shown as a first screen if createSession function returns showMandatoryConsent
with true
value (in that case createSession will also return regulationType
which you have to pass as param into this function).
Parameters:
Name | Type | Description |
---|---|---|
token | object | The session object get in createSession |
onSuccess | function | Callback after consent is successfully given |
onCancel | function | Callback after consent is canceled |
regulationType | string | State string received in createSession method if users Geo Ip Location is in California, Texas, Illinois or Washington (possible values: US_California, US_Texas, US_Illinois or US_Washington) |
Example:
incode.renderBiometricConsent(document.getElementById("app"), {
token: session,
onSuccess: console.log,
onCancel: console.log,
regulationType: "US_Illinois",
});
renderUserConsent​
Description:
Renders a privacy consent interface within a specified DOM element. This function allows for displaying a consent form that is either predefined in the dashboard or uses a default configuration.
Parameters:
Name | Type | Description |
---|---|---|
element | HTMLElement | The DOM element where the consent interface will be rendered. If null , the function will not perform any operation. |
options | object | An object containing configuration options for the consent interface. The options object includes the properties described below: |
options.session | Session | The session object containing user session data, necessary for determining the consent state or user preferences. |
options.onSuccess | () => void | A callback function that is called when the user provides consent, facilitating further actions or analytics tracking. |
options.title | string (Optional) | The title of the consent dialog. If not specified, a default title from the dashboard or predefined settings will be used. |
options.text | string (Optional) | The descriptive text displayed in the consent dialog, providing context or details about the consent being requested. Falls back to a default if not provided. |
Example:
// Locate the DOM element where the consent dialog should be rendered
const consentElement = document.getElementById("consent-root");
// Define the onSuccess callback function
const handleConsentGiven = () => {
console.log("User consent granted.");
};
// Define the configuration options for the consent dialog
const consentOptions = {
session: session,
onSuccess: handleConsentGiven,
title: "Privacy and Cookies Consent",
text: "We use cookies to ensure you get the best experience on our website. By continuing, you agree to our privacy policy.",
// Optionally, provide a custom JSX component for additional consent options
customCheck: null, // Assuming no custom JSX element is provided
};
// Call the renderUserConsent function with the defined parameters
renderUserConsent(consentElement, consentOptions);