POST / HTTP/1.1
Host: api.shuftipro.com
Content-Type: application/json
Authorization: Basic WU9VUl9DTElFTlRfSUQ6WU9VUl9TRUNSRVRfS0VZ
{
//your unique request reference
"reference" : "1234567",
//URL where you will receive the webhooks from Shufti Pro
"callback_url" : "http://www.example.com/",
//end-user email
"email" : "johndoe@example.com",
//end-user country
"country" : "",
//select ISO2 code for your desired language on verification screen
"language" : "EN",
//URL where end-user will be redirected after verification completed
"redirect_url" : "",
//what kind of proofs will be provided to Shufti Pro for verification?
"verification_mode" : "",
//allow end-user to upload verification proofs if the webcam is not accessible
"allow_offline" : "1",
//allow end user to upload real-time or already catured proofs
"allow_online" : "1",
//privacy policy screen will be shown to end-user
"show_privacy_policy" : "1",
//verification results screen will be shown to end-user
"show_results" : "1",
//consent screen will be shown to end-user
"show_consent" : "1",
//User can send Feedback
"show_feedback_form" : "1",
//face onsite verification
"face": {
"proof" : ""
},
//face offsite verification
"face": {
"proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII="
},
//document onsite verification with OCR
"document" : {
"proof" : "",
"supported_types" : ["id_card","driving_license","passport"],
"name" : "",
"dob" : "",
"issue_date" : "",
"expiry_date" : "",
"document_number" : "",
"fetch_enhanced_data" : "1",
"gender" : "",
"place_of_issue" : ""
},
//document onsite verification without OCR
"document" : {
"proof" : "",
"supported_types" : ["id_card","driving_license","passport"],
"name" : {
"first_name" : "John",
"middle_name" : "Middleman",
"last_name" : "Doe"
},
"dob" : "1980-11-12",
"issue_date" : "1990-09-07",
"expiry_date" : "2050-10-10",
"document_number" : "0989-7752-6291-2387",
"fetch_enhanced_data": "1",
"gender" : "M",
"place_of_issue" : "US"
},
//document offsite verification without OCR
"document" : {
"proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"additional_proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"supported_types" : ["id_card","driving_license","passport"],
"name" : {
"first_name" : "John",
"middle_name" : "Middleman",
"last_name" : "Doe"
},
"dob" : "1980-11-12",
"issue_date" : "1990-09-07",
"expiry_date" : "2050-10-10",
"document_number" : "0989-7752-6291-2387,"
"fetch_enhanced_data" : "1",
"gender" : "M",
"place_of_issue" : "US"
},
//document offsite verification with OCR
"document" : {
"proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"additional_proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"supported_types" : ["id_card","driving_license","passport"],
"name" : "",
"dob" : "",
"issue_date" : "",
"expiry_date" : "",
"document_number" : "",
"fetch_enhanced_data" : "1",
"gender" : "",
"place_of_issue" : ""
},
//document two onsite verification with OCR
"document_two" : {
"proof" : "",
"supported_types" : ["id_card","driving_license","passport"],
"name" : "",
"dob" : "",
"issue_date" : "",
"expiry_date" : "",
"document_number" : "",
"fetch_enhanced_data" : "1",
"gender" : ""
},
//document two onsite verification without OCR
"document_two" : {
"proof" : "",
"supported_types" : ["id_card","driving_license","passport"],
"name" : {
"first_name" : "John",
"middle_name" : "Middleman",
"last_name" : "Doe"
},
"dob" : "1980-11-12",
"issue_date" : "1990-09-07",
"expiry_date" : "2050-10-10",
"document_number" : "0989-7752-6291-2387",
"fetch_enhanced_data": "1",
"gender" : "M"
},
//document two offsite verification without OCR
"document_two" : {
"proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"additional_proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"supported_types" : ["id_card","driving_license","passport"],
"name" : {
"first_name" : "John",
"middle_name" : "Middleman",
"last_name" : "Doe"
},
"dob" : "1980-11-12",
"issue_date" : "1990-09-07",
"expiry_date" : "2050-10-10",
"document_number" : "0989-7752-6291-2387",
"fetch_enhanced_data" : "1",
"gender" : "M"
},
//document two offsite verification with OCR
"document_two" : {
"proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"additional_proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"supported_types" : ["id_card","driving_license","passport"],
"name" : "",
"dob" : "",
"issue_date" : "",
"expiry_date" : "",
"document_number" : ""
"fetch_enhanced_data" : "1",
"gender" : ""
},
//address onsite verification with OCR
"address" : {
"proof" : "",
"supported_types" : ["id_card","bank_statement"],
"name" : "",
"issue_date" : "",
"full_address" : "",
"address_fuzzy_match" : "1"
},
//address onsite verification without OCR
"address" : {
"proof" : "",
"supported_types" : ["id_card","bank_statement"],
"name" : {
"first_name" : "John",
"middle_name" : "Middleman",
"last_name" : "Doe"
},
"full_address" : "3339 Maryland Avenue, Largo, Florida",
"address_fuzzy_match" : "1",
"issue_date" : "1990-09-07"
},
//address offsite verification without OCR
"address" : {
"proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"supported_types" : ["id_card","bank_statement"],
"name" : {
"first_name" : "John",
"middle_name" : "Middleman",
"last_name" : "Doe"
},
"full_address" : "3339 Maryland Avenue, Largo, Florida",
"address_fuzzy_match" : "1",
"issue_date" : "1990-09-07"
},
//address offsite verification with OCR
"address" : {
"proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"supported_types" : ["id_card","bank_statement"],
"name" : "",
"full_address" : "",
"address_fuzzy_match" : "1",
"issue_date" : ""
},
//consent onsite verification
"consent":{
"proof" : "",
"supported_types" : ["handwritten","printed"],
"text" : "this is a customised text"
},
//consent offsite verification
"consent":{
"proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII=",
"supported_types" : ["handwritten","printed"],
"text" : "this is a customised text"
},
//phone verification
"phone": {
"phone_number" : "+4400000000",
"random_code" : "23234",
"text" : "Your verification code is 23234"
},
//background/AML checks verification without ocr
"background_checks": {
"name" : {
"first_name" : "John",
"middle_name" : "Middleman",
"last_name" : "Doe",
"full_name" : "John Middleman Doe"
},
"dob" : "1980-11-12"
}
//background/AML checks verification with ocr
"background_checks": ""
}
/**
* NOTE:
* Install or include the js-sha256 library to calculate the response in sha256 hash
* Install via npm:
* - npm i js-sha256
* or include from cdn:
* - https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.9.0/sha256.min.js
**/
let payload = {
//your unique request reference
"reference" : `SP_REQUEST_${Math.random()}`,
//URL where you will receive the webhooks from Shufti Pro
"callback_url" : "https://yourdomain.com/profile/sp-notify-callback",
//end-user email
"email" : "johndoe@example.com",
//end-user country
"country" : "",
//select ISO2 code for your desired language on verification screen
"language" : "EN",
//URL where end-user will be redirected after verification completed
"redirect_url" : "",
//what kind of proofs will be provided to Shufti Pro for verification?
"verification_mode" : "",
//allow end-user to upload verification proofs if the webcam is not accessible
"allow_offline" : "1",
//allow end user to upload real-time or already catured proofs
"allow_online" : "1",
//privacy policy screen will be shown to end-user
"show_privacy_policy" : "1",
//verification results screen will be shown to end-user
"show_results" : "1",
//consent screen will be shown to end-user
"show_consent" : "1",
//User can send Feedback
"show_feedback_form" : "1",
}
//face onsite verification
payload['face'] = ""
convertImgToBase64URL('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-face.jpg').then(response=>{
//face offsite verification
payload['face'] = {
'proof' : response
}
//document onsite verification with OCR
payload['document'] = {
'name' : "",
'dob' : "",
'gender' : "",
'place_of_issue' : "",
'document_number' : "",
'expiry_date' : "",
'issue_date' : "",
'fetch_enhanced_data ' : "1",
'supported_types' : ['id_card','passport']
}
//document onsite verification without OCR
payload['document'] = {
name : {
'first_name' : 'Your first name',
'last_name' : 'You last name',
'fuzzy_match' : '1'
},
'dob' : '1992-10-10',
'gender' : "M",
'place_of_issue' : "US",
'document_number' : '2323-5629-5465-9990',
'expiry_date' : '2025-10-10',
'issue_date' : '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
//document two onsite verification with OCR
payload['document_two'] = {
'name' : "",
'dob' : "",
'gender' : "",
'document_number' : "",
'expiry_date' : "",
'issue_date' : "",
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
//document two onsite verification without OCR
payload['document_two'] = {
'name' : {
'first_name' : 'Your first name',
'last_name' : 'You last name',
'fuzzy_match' : '1'
},
'dob' : '1992-10-10',
'gender' : 'M',
'document_number' : '2323-5629-5465-9990',
'expiry_date' : '2025-10-10',
'issue_date' : '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
//address onsite verification with OCR
payload['address'] = {
'name' : "",
'full_address' : "",
'address_fuzzy_match' : '1',
'issue_date' : "",
'supported_types' : ['utility_bill','passport','bank_statement']
}
//address onsite verification without OCR
payload['address'] = {
'name' : {
'first_name' : 'Your first name',
'last_name' : 'You last name',
'fuzzy_match' : '1'
},
'full_address' : 'your address',
'address_fuzzy_match' : '1',
'issue_date' : '2015-10-10',
'supported_types' : ['utility_bill','passport','bank_statement']
}
//consent onsite verification
payload['consent'] = {
'proof' : "",
'supported_types' : ["handwritten","printed"],
'text' : "this is a customised text"
}
//phone verification
payload['phone'] = {
'phone_number' : "+4400000000",
'random_code' : "23234",
'text' : "Your verification code is 23234"
}
//background check/AML verification without OCR
payload['background_checks'] = {
name : {
'first_name' : 'Your first name',
'middle_name' : 'Your middle name',
'last_name' : 'You last name',
'full_name' : 'your full name'
},
'dob' : '1994-01-01',
}
//background check/AML verification with OCR
payload['background_checks'] = ""
var token = btoa("YOUR_CLIENT_ID:YOUR_SECRET_KEY"); //BASIC AUTH TOKEN
var responsesignature = null;
//Dispatch request via fetch API or with whatever else which best suits for you
fetch('https://api.shuftipro.com/',
{
method : 'post',
headers : {
'Accept' : 'application/json',
'Content-Type' : 'application/json',
'Authorization' : 'Basic ' +token
},
body: JSON.stringify(payload)
})
.then(function(response) {
responsesignature = response.headers.get('Signature');
return response.json();
}).then(function(data) {
if(validatesignature(data,responsesignature,'YOUR_SECRET_KEY')){
console.log('signature validated',data)
}else{
console.log('signature not validated',data)
}
});
//this method is used to validate the response signature
function validatesignature(data,signature,SK){
data = JSON.stringify(data);
data = data.replace(/\//g,"\\/")
data = `${data}${SK}`;
sha256(data);
var hash = sha256.create();
hash.update(data);
if(hash.hex() == signature){
return true;
}else{
return false;
}
}
convertImgToBase64URL('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').then(response=>{
//offsite document verification without OCR
payload['document'] = {
'proof' : response,
'additional_proof' : response,
'name' : {
'first_name' : 'Your first name',
'last_name' : 'You last name',
'fuzzy_match' : '1'
},
'dob' : '1992-10-10',
'gender' : 'M',
'place_of_issue' : 'US',
'document_number' : '2323-5629-5465-9990',
'expiry_date' : '2025-10-10',
'issue_date' : '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
//offsite document verification with OCR
payload['document'] = {
'proof' : response,
'additional_proof' : response,
'name' : "",
'dob' : "",
'gender' : "",
'place_of_issue' : "",
'document_number' : "",
'expiry_date' : "",
'issue_date' : "",
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
//offsite document two verification without OCR
payload['document_two'] = {
'proof' : 'response',
'additional_proof' : response,
name : {
'first_name' : 'Your first name',
'last_name' : 'You last name',
'fuzzy_match' : '1'
},
'dob' : '1992-10-10',
'gender' : 'M',
'document_number' : '2323-5629-5465-9990',
'expiry_date' : '2025-10-10',
'issue_date' : '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
//offsite document two verification with OCR
payload['document_two'] = {
'proof' : response,
'additional_proof' : response,
'name' : "",
'dob' : "",
'gender' : '',
'document_number' : "",
'expiry_date' : "",
'issue_date' : "",
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
//offsite address verification without OCR
payload['address'] = {
'proof' : response,
'name' : {
'first_name' : 'Your first name',
'last_name' : 'You last name',
'fuzzy_match' : '1'
},
'full_address' : 'your address',
'address_fuzzy_match' : '1',
'issue_date' : '2015-10-10',
'supported_types' : ['utility_bill','passport','bank_statement']
}
//offsite address verification with OCR
payload['address'] = {
'proof' : response,
name : "",
'full_address' : "",
'address_fuzzy_match' : '1',
'issue_date' : "",
'supported_types' : ['utility_bill','passport','bank_statement']
}
//offsite consent verification
payload['consent'] = {
'proof' : response,
'supported_types' : ["handwritten","printed"],
'text' : "this is a customised text"
}
var token = btoa("YOUR_CLIENT_ID:YOUR_SECRET_KEY"); //BASIC AUTH TOKEN
var responsesignature = null;
//Dispatch request via fetch API or with whatever else which best suits for you
fetch('https://api.shuftipro.com/',
{
method : 'post',
headers : {
'Accept' : 'application/json',
'Content-Type' : 'application/json',
'Authorization' : 'Basic ' +token
},
body: JSON.stringify(payload)
})
.then(function(response) {
responsesignature = response.headers.get('Signature');
return response.json();
}).then(function(data) {
if(validatesignature(data,responsesignature,'YOUR_SECRET_KEY')){
console.log('signature validated',data)
}else{
console.log('signature not validated',data)
}
return data;
});
})
})
/*METHOD USED TO Get image BASE 64 string*/
function convertImgToBase64URL(url){
return new Promise(function(resolve, reject) {
var img = new Image();
img.crossOrigin = 'Anonymous';
img.onload = function(){
var canvas = document.createElement('CANVAS'),
ctx = canvas.getContext('2d'), dataURL;
canvas.height = img.height;
canvas.width = img.width;
ctx.drawImage(img, 0, 0);
dataURL = canvas.toDataURL('image/jpeg');
resolve(dataURL);
canvas = null;
};
img.src = url;
})
}
//this method is used to validate Shufti Pro response signature
function validatesignature(data,signature,SK){
data = JSON.stringify(data);
data = data.replace(/\//g,"\\/")
data = `${data}${SK}`;
sha256(data);
var hash = sha256.create();
hash.update(data);
if(hash.hex() == signature){
return true;
}else{
return false;
}
}
Shufti Pro API base URL
$url = 'https://api.shuftipro.com/';
//your Shufti Pro account Client ID
$client_id = 'YOUR_CLIENT_ID';
//your Shufti Pro account Secret Key
$secret_key = 'YOUR_SECRET_KEY';
$verification_request = [
//your unique request reference
"reference" => 'ref-'.rand(4,444).rand(4,444),
//URL where you will receive the webhooks from Shufti Pro
"callback_url" => 'https://yourdomain.com/profile/notifyCallback',
//end-user email
"email" => "johndoe@example.com",
//end-user country
"country" => "",
//select ISO2 code for your desired language on verification screen
"language" => "EN",
//URL where end-user will be redirected after verification completed
"redirect_url" => "",
//what kind of proofs will be provided to Shufti Pro for verification?
"verification_mode" => "",
//allow end-user to upload verification proofs if the webcam is not accessible
"allow_offline" => "1",
//allow end user to upload real-time or already catured proofs
"allow_online" => "1",
//privacy policy screen will be shown to end-user
"show_privacy_policy" => "1",
//verification results screen will be shown to end-user
"show_results" => "1",
//consent screen will be shown to end-user
"show_consent" => "1",
//User can send Feedback
"show_feedback_form" => "1",
];
//face onsite verification
$verification_request['face'] = [];
//face onffite verification
$verification_request['face'] = [
'proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-face.jpg'))
];
//document onsite verification with OCR
$verification_request['document'] =[
'name' => "",
'dob' => "",
'gender' => "",
'place_of_issue' => "",
'document_number' => "",
'expiry_date' => "",
'issue_date' => "",
'fetch_enhanced_data' => "1",
'supported_types' => ['id_card','passport']
];
//document onsite verification without OCR
$verification_request['document'] =[
'name' => [
'first_name' => 'Your first name',
'last_name' => 'You last name',
'fuzzy_match' => '1'
],
'dob' => '1992-10-10',
'document_number' => '2323-5629-5465-9990',
'expiry_date' => '2025-10-10',
'issue_date' => '2015-10-10',
'fetch_enhanced_data' => "1",
'supported_types' => ['id_card','passport']
];
//document offsite verification with OCR
$verification_request['document'] =[
'proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'additional_proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'name' => "",
'dob' => "",
'document_number' => "",
'expiry_date' => "",
'issue_date' => "",
'fetch_enhanced_data' => "1",
'supported_types' => ['id_card','passport']
];
//document offsite verification without OCR
$verification_request['document'] =[
'proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'additional_proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'name' => [
'first_name' => 'Your first name',
'last_name' => 'You last name',
'fuzzy_match' => '1'
],
'dob' => '1992-10-10',
'document_number' => '2323-5629-5465-9990',
'expiry_date' => '2025-10-10',
'issue_date' => '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' => ['id_card','passport']
];
//document two onsite verification with OCR
$verification_request['document_two'] =[
'name' => "",
'dob' => "",
'gender' => "",
'document_number' => "",
'expiry_date' => "",
'issue_date' => "",
'fetch_enhanced_data' => "1",
'supported_types' => ['id_card','passport']
];
//document two onsite verification without OCR
$verification_request['document_two'] =[
'name' => [
'first_name' => 'Your first name',
'last_name' => 'You last name',
'fuzzy_match' => '1'
],
'dob' => '1992-10-10',
'gender' => 'M',
'document_number' => '2323-5629-5465-9990',
'expiry_date' => '2025-10-10',
'issue_date' => '2015-10-10',
'fetch_enhanced_data' => "1",
'supported_types' => ['id_card','passport']
];
//document two offsite verification with OCR
$verification_request['document_two'] =[
'proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'additional_proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'name' => "",
'dob' => "",
'gender' => "",
'document_number' => "",
'expiry_date' => "",
'issue_date' => "",
'fetch_enhanced_data' => "1",
'supported_types' => ['id_card','passport']
];
//document two offsite verification without OCR
$verification_request['document_two'] =[
'proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'additional_proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'name' => [
'first_name' => 'Your first name',
'last_name' => 'You last name',
'fuzzy_match' => '1'
],
'dob' => '1992-10-10',
'gender' => 'M',
'document_number' => '2323-5629-5465-9990',
'expiry_date' => '2025-10-10',
'issue_date' => '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' => ['id_card','passport']
];
//address onsite verification with OCR
$verification_request['address'] = [
'name' => "",
'full_address' => "",
'address_fuzzy_match' => '1',
'issue_date' => "",
'supported_types' => ['utility_bill','passport','bank_statement']
];
//address onsite verification without OCR
$verification_request['address'] = [
'name' => [
'first_name' => 'Your first name',
'last_name' => 'You last name',
'fuzzy_match' => '1'
],
'full_address' => 'your address',
'address_fuzzy_match' => '1',
'issue_date' => '2015-10-10',
'supported_types' => ['utility_bill','passport','bank_statement']
];
//address offsite verification with OCR
$verification_request['address'] = [
'proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'name' => "",
'full_address' => "",
'address_fuzzy_match' => '1',
'issue_date' => "",
'supported_types' => ['utility_bill','passport','bank_statement']
];
//address onsite verification without OCR
$verification_request['address'] = [
'proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg')),
'name' => [
'first_name' => 'Your first name',
'last_name' => 'You last name',
'fuzzy_match' => '1'
],
'full_address' => 'your address',
'address_fuzzy_match' => '1',
'issue_date' => '2015-10-10',
'supported_types' => ['utility_bill','passport','bank_statement']
];
//consent onsite verification
$verification_request['consent'] =[
'text' => 'some text for consent verificaiton',
'supported_types' => ['handwritten','printed'],
];
//consent offsite verification
$verification_request['consent'] =[
'proof' => base64_encode(file_get_contents('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-consent-document.jpg')),
'text' => 'some text for consent verificaiton',
'supported_types' => ['handwritten','printed'],
];
//phone verification
$verification_request['phone'] =[
'phone_number' => '+1378746734',
'random_code' => '9977',
'text' => 'Your verification code is 9977'
];
//background checks/AML verification without OCR
$verification_request['background_checks'] = [
'name' => [
'first_name' => 'Your first name',
'last_name' => 'You last name',
'full_name' => 'your full name'
],
'dob' => '1992-10-10',
];
$verification_request['background_checks'] = "";
$auth = $client_id.":".$secret_key;
$headers = ['Content-Type: application/json'];
$post_data = json_encode($verification_request);
//Calling Shufti Pro request API using curl
$response = send_curl($url, $post_data, $headers, $auth);
//get Shufti Pro API Response
$response_data = $response['body'];
//get Shufti Pro Signature
$sp_signature = get_header_keys($response['headers'])['signature'];
//calculating signature for verification
$calculate_signature = hash('sha256',$response_data.$secret_key);
$decoded_response = json_decode($response_data,true);
$event_name = $decoded_response['event'];
if($event_name == 'request.pending'){
if($sp_signature == $calculate_signature){
$verification_url = $decoded_response['verification_url'];
echo "Verification url : $verification_url";
}else{
echo "Invalid signature : $response_data";
}
}else{
echo "Error : $response_data";
}
//method to send CURL request
function send_curl($url, $post_data, $headers, $auth){
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERPWD, $auth);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$html_response = curl_exec($ch);
$curl_info = curl_getinfo($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$headers = substr($html_response, 0, $header_size);
$body = substr($html_response, $header_size);
curl_close($ch);
return ['headers' => $headers,'body' => $body];
}
//following method is to get response headers, here the main intention is to get response Signature from the response headers
function get_header_keys($header_string){
$headers = [];
$exploded = explode("\n", $header_string);
if(!empty($exploded)){
foreach ($exploded as $key => $header) {
if (!$key) {
$headers[] = $header;
} else {
$header = explode(':', $header);
$headers[trim($header[0])] = isset($header[1]) ? trim($header[1]) : "";
}
}
}
return $headers;
}
"""
If you run into error: 'ImportError: No module named requests'
Please run
- pip install requests
"""
"""
Python 2
import urllib2
Python 3
import urllib.request
urllib.request.urlopen(url).read()
"""
#import required libraries
import urllib2, base64, requests, json, hashlib
from random import randint
#Shufti Pro api base url
url = 'https://api.shuftipro.com/'
# Your Shufti Pro account Client ID
client_id = 'YOUR_CLIENT_ID'
# Your Shufti Pro account Secret Key
secret_key = 'YOUR_SECRET_KEY'
verification_request = {
#your unique request reference
"reference" : 'ref-{}{}'.format(randint(1000, 9999), randint(1000, 9999)),
#URL where you will receive the webhooks from Shufti Pro
"callback_url" : 'https://yourdomain.com/profile/notifyCallback',
#end-user email
"email" : "johndoe@example.com",
#end-user country
"country" : "",
#select ISO2 Code for your desired language on verification screen
"language" : "EN",
#URL where end-user will be redirected after verification completed
"redirect_url" : "",
#what kind of proofs will be provided to Shufti Pro for verification?
"verification_mode" : "",
#allow end-user to upload verification proofs if the webcam is not accessible
"allow_offline" : "1",
#allow end user to upload real-time or already catured proofs
"allow_online" : "1",
#privacy policy screen will be shown to end-user
"show_privacy_policy" : "1",
#verification results screen will be shown to end-user
"show_results" : "1",
#consent screen will be shown to end-user
"show_consent" : "1",
#User can send Feedback
"show_feedback_form" : "1",
}
#face onsite verification
verification_request['face'] = {}
#face offsite verification
verification_request['face'] = {
'proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-face.jpg').read())
}
#document onsite verification with OCR
verification_request['document'] = {
'name' : "",
'dob' : "",
'gender' : "",
'place_of_issue' : "",
'document_number' : "",
'expiry_date' : "",
'issue_date' : "",
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
#document onsite verification without OCR
verification_request['document'] = {
'name' : {
'first_name' : 'Your first name',
'last_name' : 'Your last name',
'fuzzy_match' : '1'
},
'dob' : '1992-10-10',
'document_number' : '2323-5629-5465-9990',
'expiry_date' : '2025-10-10',
'issue_date' : '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
#document offsite verification with OCR
verification_request['document'] = {
'proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'additional_proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'name' : "",
'dob' : "",
'document_number' : "",
'expiry_date' : "",
'issue_date' : "",
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
#document offsite verification without OCR
verification_request['document'] = {
'proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'additional_proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'name' : {
'first_name' : 'Your first name',
'last_name' : 'Your last name',
'fuzzy_match' : '1'
},
'dob' : '1992-10-10',
'document_number' : '2323-5629-5465-9990',
'expiry_date' : '2025-10-10',
'issue_date' : '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
#document two onsite verification with OCR
verification_request['document_two'] = {
'name' : "",
'dob' : "",
'gender' : "",
'document_number' : "",
'expiry_date' : "",
'issue_date' : "",
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
#document two onsite verification without OCR
verification_request['document_two'] = {
'name' : {
'first_name' : 'Your first name',
'last_name' : 'Your last name',
'fuzzy_match' : '1'
},
'dob' : '1992-10-10',
'gender' : 'M',
'document_number' : '2323-5629-5465-9990',
'expiry_date' : '2025-10-10',
'issue_date' : '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
#document two offsite verification with OCR
verification_request['document_two'] = {
'proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'additional_proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'name' : "",
'dob' : "",
'gender' : "",
'document_number' : "",
'expiry_date' : "",
'issue_date' : "",
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
#document two offsite verification without OCR
verification_request['document_two'] = {
'proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'additional_proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'name' : {
'first_name' : 'Your first name',
'last_name' : 'Your last name',
'fuzzy_match' : '1'
},
'dob' : '1992-10-10',
'gender' : 'M',
'document_number' : '2323-5629-5465-9990',
'expiry_date' : '2025-10-10',
'issue_date' : '2015-10-10',
'fetch_enhanced_data' : "1",
'supported_types' : ['id_card','passport']
}
#address onsite verification with OCR
verification_request['address'] = {
'name' : "",
'full_address' : "",
'address_fuzzy_match' : '1',
'issue_date' : "",
'supported_types' : ['utility_bill','passport','bank_statement']
}
#address onsite verification without OCR
verification_request['address'] = {
'name' : {
'first_name' : 'Your first name',
'last_name' : 'Your last name',
'fuzzy_match' : '1'
},
'full_address' : 'your address',
'address_fuzzy_match' : '1',
'issue_date' : '2015-10-10',
'supported_types' : ['utility_bill','passport','bank_statement']
}
#address offsite verification with OCR
verification_request['address'] = {
'proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'name' : "",
'full_address' : "",
'address_fuzzy_match' : '1',
'issue_date' : "",
'supported_types' : ['utility_bill','passport','bank_statement']
}
#address offsite verification without OCR
verification_request['address'] = {
'proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()),
'name' : {
'first_name' : 'Your first name',
'last_name' : 'Your last name',
'fuzzy_match' : '1'
},
'full_address' : 'your address',
'address_fuzzy_match' : '1',
'issue_date' : '2015-10-10',
'supported_types' : ['utility_bill','passport','bank_statement']
}
#consent onsite verification
verification_request['consent'] = {
'text' : 'some text for consent verificaiton',
'supported_type' : ['handwritten','printed']
}
#consent offsite verification
verification_request['consent'] = {
'proof' : base64.b64encode(urllib2.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-consent-document.jpg').read()),
'text' : 'some text for consent verificaiton',
'supported_types' : ['handwritten','printed']
}
#phone verification
verification_request['phone'] = {
'phone_number' : '+1378746734',
'random_code' : '9977',
'text' : 'Your verification code is 9977'
}
#background checks/AML verification without OCR
verification_request['background_checks'] = {
'name' : {
'first_name' : 'Your first name',
'last_name' : 'Your last name',
'full_name' : 'your full name'
},
'dob' : '1992-10-10'
}
#background checks/AML verification with OCR
verification_request['background_checks'] = ""
# calling Shufti Pro request API using python request
auth = '{}:{}'.format(client_id, secret_key)
b64Val = base64.b64encode(auth.encode()).decode()
response = requests.post(url,
headers={"Authorization": "Basic %s" % b64Val, "Content-Type": "application/json"},
data=json.dumps(verification_request))
# calculating signature for verification
calculated_signature = hashlib.sha256('{}{}'.format(response.content.decode(), secret_key).encode()).hexdigest()
# get Shufti Pro Signature
sp_signature = response.headers.get('Signature',"")
# Convert json string to json object
json_response = json.loads((response.content).decode())
# Get event returned
event_name = json_response['event']
print(json_response)
if event_name == 'request.pending':
if sp_signature == calculated_signature:
verification_url = json_response['verification_url']
print('Verification URL: {}'.format(verification_url))
else:
print('Invalid signature: {}'.format(response.content))
#include required libraries
require 'uri'
require 'net/http'
require 'base64'
require 'json'
require 'open-uri'
#Shufti Pro api base url
url = URI("https://api.shuftipro.com/")
#your Shufti Pro account Client ID
CLIENT_ID = 'YOUR_CLIENT_ID'
#your Shufti Pro account Secret Key
SECRET_KEY = 'YOUR_SECRET_KEY'
#face offsite sample image
SAMPLE_FACE_IMAGE = "https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-face.jpg"
#document offsite sample image
SAMPLE_DOCUMENT_IMAGE = "https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg"
#consent offsite sample image
SAMPLE_CONSENT_IMAGE = "https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-consent-document.jpg"
verification_request = {
#your unique request reference
"reference": 'Ref-'+ (0...8).map { (65 + rand(26)).chr }.join,
#URL where you will receive the webhooks from Shufti Pro
"callback_url": 'https://yourdomain.com/profile/notifyCallback',
#end-user email
"email": "johndoe@example.com",
#end-user country
"country": "",
#select ISO2 Code for your desired language on verification screen
"language": "EN",
#URL where end-user will be redirected after verification completed
"redirect_url": "",
#what kind of proofs will be provided to Shufti Pro for verification?
"verification_mode": "",
#allow end-user to upload verification proofs if the webcam is not accessible
"allow_offline": "1",
#allow end user to upload real-time or already catured proofs
"allow_online": "1",
#privacy policy screen will be shown to end-user
"show_privacy_policy": "1",
#verification results screen will be shown to end-user
"show_results": "1",
#consent screen will be shown to end-user
"show_consent": "1",
#User can send Feedback
"show_feedback_form": "1",
}
#face onsite verification
verification_request['face'] = {}
#face offsite verification
verification_request["face"] = {
'proof': Base64.encode64(open(SAMPLE_FACE_IMAGE).read),
}
#document onsite verification with OCR
verification_request['document'] = {
'supported_types': ['id_card','driving_license','passport'],
'name': "",
'dob': "",
'gender': "",
'place_of_issue': "",
'document_number': "",
'expiry_date': "",
'issue_date': "",
'fetch_enhanced_data': "1",
}
#document onsite verification without OCR
verification_request['document'] = {
'supported_types': ['id_card','driving_license','passport'],
'name': {
'first_name': 'Your first name',
'last_name': 'Your last name',
'fuzzy_match': '1'
},
'dob': '1992-10-10',
'gender': "M",
'place_of_issue': "US",
'document_number': '2323-5629-5465-9990',
'expiry_date': '2025-10-10',
'issue_date': '2015-10-10',
'fetch_enhanced_data': "1",
}
#document offsite verification with OCR
verification_request['document'] = {
'proof': Base64.encode64(open(SAMPLE_DOCUMENT_IMAGE).read),
'name': "",
'dob': "",
'gender': "",
'place_of_issue': "",
'document_number': "",
'expiry_date': "",
'issue_date': "",
'fetch_enhanced_data': "1",
'supported_types': ['id_card','driving_license','passport'],
}
#document offsite verification without OCR
verification_request['document'] = {
'proof': Base64.encode64(open(SAMPLE_DOCUMENT_IMAGE).read),
'supported_types': ['id_card','driving_license','passport'],
'name': {
'first_name': 'Your first name',
'last_name': 'Your last name',
'fuzzy_match': '1'
},
'dob': '1992-10-10',
'gender': "M",
'place_of_issue': "US",
'document_number': '2323-5629-5465-9990',
'expiry_date': '2025-10-10',
'issue_date': '2015-10-10',
'fetch_enhanced_data': "1",
}
#document two onsite verification with OCR
verification_request['document_two'] = {
'supported_types': ['id_card','driving_license','passport'],
'name': "",
'dob': "",
'gender': "",
'document_number': "",
'expiry_date': "",
'issue_date': "",
'fetch_enhanced_data': "1",
}
#document two onsite verification without OCR
verification_request['document_two'] = {
'supported_types': ['id_card','driving_license','passport'],
'name': {
'first_name': 'Your first name',
'last_name': 'Your last name',
'fuzzy_match': '1'
},
'dob': '1992-10-10',
'gender': "M",
'document_number': '2323-5629-5465-9990',
'expiry_date': '2025-10-10',
'issue_date': '2015-10-10',
'fetch_enhanced_data': "1",
}
#document two offsite verification with OCR
verification_request['document_two'] = {
'proof': Base64.encode64(open(SAMPLE_DOCUMENT_IMAGE).read),
'name': "",
'dob': "",
'gender': "",
'document_number': "",
'expiry_date': "",
'issue_date': "",
'fetch_enhanced_data': "1",
'supported_types': ['id_card','driving_license','passport'],
}
#document two offsite verification without OCR
verification_request['document_two'] = {
'proof': Base64.encode64(open(SAMPLE_DOCUMENT_IMAGE).read),
'supported_types': ['id_card','driving_license','passport'],
'name': {
'first_name': 'Your first name',
'last_name': 'Your last name',
'fuzzy_match': '1'
},
'dob': '1992-10-10',
'gender': "M",
'document_number': '2323-5629-5465-9990',
'expiry_date': '2025-10-10',
'issue_date': '2015-10-10',
'fetch_enhanced_data': "1",
}
#address onsite verification with OCR
verification_request['address'] = {
'name': "",
'full_address': "",
'address_fuzzy_match': '1',
'issue_date': "",
'supported_types': ['utility_bill','passport','bank_statement']
}
#address onsite verification without OCR
verification_request['address'] = {
'name': {
'first_name': 'Your first name',
'last_name': 'Your last name',
},
'full_address': 'your address',
'address_fuzzy_match': '1',
'issue_date': '2015-10-10',
'supported_types': ['utility_bill','passport','bank_statement']
}
#address offsite verification with OCR
verification_request['address'] = {
'proof': Base64.encode64(open(SAMPLE_DOCUMENT_IMAGE).read),
'name': "",
'full_address': "",
'address_fuzzy_match': '1',
'issue_date': "",
'supported_types': ['utility_bill','passport','bank_statement']
}
#address offsite verification without OCR
verification_request['address'] = {
'proof': Base64.encode64(open(SAMPLE_DOCUMENT_IMAGE).read),
'name': {
'first_name': 'Your first name',
'last_name': 'Your last name',
},
'full_address': 'your address',
'address_fuzzy_match': '1',
'issue_date': '2015-10-10',
'supported_types': ['utility_bill','passport','bank_statement']
}
#consent onsite verification
verification_request['consent'] = {
'text': 'some text for consent verificaiton',
'supported_type': ['handwritten','printed']
}
#consent offsite verification
verification_request['consent'] = {
'proof': Base64.encode64(open(SAMPLE_CONSENT_IMAGE).read),
'text': 'some text for consent verificaiton',
'supported_types': ['handwritten','printed']
}
#phone verification
verification_request['phone'] = {
'phone_number': '+1378746734',
'random_code': '9977',
'text': 'Your verification code is 9977'
}
#background checks/AML verification without OCR
verification_request['background_checks'] = {
'name': {
'first_name': 'Your first name',
'last_name': 'Your last name',
'full_name': 'your full name'
},
'dob': '1992-10-10'
}
#background checks/AML verification with OCR
verification_request['background_checks'] = ""
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
#set BASIC AUTH
header_auth = Base64.strict_encode64("#{CLIENT_ID}:#{SECRET_KEY}")
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic #{header_auth}"
request.body = verification_request.to_json
response = http.request(request)
response_headers = response.instance_variable_get("@header")
response_data = response.read_body
sp_signature = !(response_headers['signature'].nil?) ? response_headers['signature'].join(',') : ""
calculated_signature = Digest::SHA256.hexdigest response_data + SECRET_KEY
if sp_signature == calculated_signature
puts response_data
else
puts "Invalid signature"
end