Please select required verification services to generate integration code
Face Verification
Document Verification
Document Two Verification
Address Verification
2 Factor Authentication
AML Checks

Please select request options


Verification Mode ?
Redirect URL ?
Privacy Policy ? ?
Allow Offline ? ?
Allow Online ? ?
Show Results ? ?
Show Feedback ? ?
Enhanced Data ? ?

Please select all the options you want to verify


For Document Service
Name
Date of birth
Issue date
Expiry date
Document number
Gender
Place of issue

For Document Two Service
Name
Date of birth
Issue date
Expiry date
Document number
Gender

For Address Service
Name
Issue date

Who will provide the verification data to Shufti Pro?
End-User will provide the verification data
Shufti Pro Customer will provide the verification data
Should Shufti Pro automatically extract data from documents?
Yes ?
No ?
    
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 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"   : "",
    //what kind of proofs will be provided to Shufti Pro for verification?
    "verification_mode": "any",
    //allow end-user to upload verification proofs if the webcam is not accessible
    "allow_offline": "1",
    //allow end-user to capture photos/videos with the camera only.
    "allow_offline": "0",
    //allow end-user to upload real-time or already catured proofs
    "allow_online": "1",
    //allow end-user to upload already captured images or videos.
    "allow_online": "0",
    //privacy policy screen will be shown to end-user
    "show_privacy_policy": "1",
    //privacy policy screen will not be shown to end-user
    "show_privacy_policy": "0",
    //verification results screen will be shown to end-user
    "show_results": "1",
    //verification results screen will not be shown to end-user
    "show_results": "0",
    //consent screen will be shown to end-user
    "show_consent": "1",
    //consent screen will not be shown to end-user
    "show_consent": "0",
    //User can send Feedback
    "show_feedback_form": "1",
    //User cannot send Feedback
    "show_feedback_form": "0",

  
  //face onsite verification
  "face": {
     "proof" : ""
  },
  //face offsite verification
  "face": {
     "proof" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAALCAYAAABCm8wlAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoPAxIb88htFgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAACxSURBVBjTdY6xasJgGEXP/RvoonvAd8hDyD84+BZBEMSxL9GtQ8Fis7i6BkGI4DP4CA4dnQON3g6WNjb2wLd8nAsHWsR3D7JXt18kALFwz2dGmPVhJt0IcenUDVsgu91eCRZ9IOMfAnBvSCz8I3QYL0yV6zfyL+VUxKWfMJuOEFd+dE3pC1Finwj0HfGBeKGmblcFTIN4U2C4m+hZAaTrASSGox6YV7k+ARAp4gIIOH0BmuY1E5TjCIUAAAAASUVORK5CYII="
  }, 
  //face offsite verification
  "face": {
     "proof" : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA=="
  }, 
  //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 without OCR
  "document" : {
     "proof"              : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "additional_proof"   : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "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 offsite verification with OCR
  "document"         : {
     "proof"              : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "additional_proof"   : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "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 without OCR
  "document_two" : {
     "proof"              : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "additional_proof"   : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "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"              : ""
  },
  //document two offsite verification with OCR
  "document_two"         : {
     "proof"              : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "additional_proof"   : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "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 without OCR
  "address" : {
     "proof"                    : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "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"            : ""
     },
  //address offsite verification with OCR
  "address"         : {
     "proof"                    : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
     "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"
  },
  //consent offsite verification
  "consent":{
        "proof"            : "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQACT29tZGF0AAACrwYF//+r3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MCByMzAwMCAzM2Y5ZTE0IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjguMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAtHRliIQAO//+AAAAXwABLAAAAUQAAAF8AAABLAAAASwAAAFIAAABeAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU4LjQ0LjEwMA==",
        "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":  {
    "name" : {
        "first_name"      : "",
        "last_name"       : ""
    }
  }
}
    
    
    
/**
* 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 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"     : "",
    //what kind of proofs will be provided to Shufti Pro for verification?
    "verification_mode": "any",
    //allow end-user to upload verification proofs if the webcam is not accessible
    "allow_offline": "1",
    //allow end-user to capture photos/videos with the camera only.
    "allow_offline": "0",
    //allow end-user to upload real-time or already catured proofs
    "allow_online": "1",
    //allow end-user to upload already captured images or videos.
    "allow_online": "0",
    //privacy policy screen will be shown to end-user
    "show_privacy_policy": "1",
    //privacy policy screen will not be shown to end-user
    "show_privacy_policy": "0",
    //verification results screen will be shown to end-user
    "show_results": "1",
    //verification results screen will not be shown to end-user
    "show_results": "0",
    //consent screen will be shown to end-user
    "show_consent": "1",
    //consent screen will not be shown to end-user
    "show_consent": "0",
    //User can send Feedback
    "show_feedback_form": "1",
    //User cannot send Feedback
    "show_feedback_form": "0",
}
//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
    }

convertVideoToBase64URL('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').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'] = {
    'name' : {
        'first_name'      : '',
        'last_name'       : ''
    }
} 

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}${sha256(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;
   }
}
convertVideoToBase64URL('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').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 video BASE 64 string*/
function convertVideoToBase64URL(filepath){
    return new Promise(function(resolve, reject) {
        var xhr = new XMLHttpRequest();
        xhr.open("GET", filepath, true);
        xhr.responseType = "blob";
        xhr.onload = function (e) {
            var reader = new FileReader();
            reader.onload = function(event) {
                resolve(event.target.result);
            }
            var file = this.response;
            reader.readAsDataURL(file)
        };
        xhr.send();
    })
};
//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 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"     => "",
    //what kind of proofs will be provided to Shufti Pro for verification?
    "verification_mode"    => "any",
    //allow end-user to upload verification proofs if the webcam is not accessible
    "allow_offline"    => "1",
    //allow end-user to capture photos/videos with the camera only.
    "allow_offline"    => "0",
    //allow end-user to upload real-time or already catured proofs
    "allow_online"    => "1",
    //allow end-user to upload already captured images or videos.
    "allow_online"    => "0",
    //privacy policy screen will be shown to end-user
    "show_privacy_policy"    => "1",
    //privacy policy screen will not be shown to end-user
    "show_privacy_policy"    => "0",
    //verification results screen will be shown to end-user
    "show_results"    => "1",
    //verification results screen will not be shown to end-user
    "show_results"    => "0",
    //consent screen will be shown to end-user
    "show_consent"    => "1",
    //consent screen will not be shown to end-user
    "show_consent"    => "0",
    //User can send Feedback
    "show_feedback_form"    => "1"
    //User cannot send Feedback
    "show_feedback_form"    => "0"
];
//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'))
];
//face onffite verification
$verification_request['face'] = [
    'proof' => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4'))
];
//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 with OCR
$verification_request['document'] =[
    'proof'                => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    'additional_proof'      => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    '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 offsite verification without OCR
$verification_request['document'] =[
    'proof'                => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    'additional_proof'      => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    '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 with OCR
$verification_request['document_two'] =[
    'proof'                => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    'additional_proof'      => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    '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']
];
//document two offsite verification without OCR
$verification_request['document_two'] =[
    'proof'                => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    'additional_proof'      => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    '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 offsite verification with OCR
$verification_request['address'] = [
    'proof'                  => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    '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']
];
//address onsite verification without OCR
$verification_request['address'] = [
    'proof'                  => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    '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'],
];
//consent offsite verification
$verification_request['consent'] =[
    'proof'             => base64_encode(file_get_contents('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4')),
    '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'] = [
    'name' => [
        'first_name'  => '',
        'last_name'  => ''
    ]
];
$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.hash('sha256',$secret_key));
$decoded_response = json_decode($response_data,true);

if($sp_signature == $calculate_signature){
    echo $response_data;
}else{
    echo "Invalid signature :  $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 base64, requests, json, hashlib
import urllib.request
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 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"     : "",
    #what kind of proofs will be provided to Shufti Pro for verification?
    "verification_mode": "any",
    #allow end-user to upload verification proofs if the webcam is not accessible
    "allow_offline": "1",
    #allow end-user to capture photos/videos with the camera only.
    "allow_offline": "0",
    #allow end-user to upload real-time or already catured proofs
    "allow_online": "1",
    #allow end-user to upload already captured images or videos.
    "allow_online": "0",
    #privacy policy screen will be shown to end-user
    "show_privacy_policy": "1",
    #privacy policy screen will not be shown to end-user
    "show_privacy_policy": "0",
    #verification results screen will be shown to end-user
    "show_results": "1",
    #verification results screen will not be shown to end-user
    "show_results": "0",
    #consent screen will be shown to end-user
    "show_consent": "1",
    #consent screen will not be shown to end-user
    "show_consent": "0",
    #User can send Feedback
    "show_feedback_form": "1",
    #User cannot send Feedback
    "show_feedback_form": "0",
}
#face onsite verification
verification_request['face'] = {}
#face offsite verification
verification_request['face'] = {
    'proof'             :   base64.b64encode(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-face.jpg').read()).decode()
        }
#face offsite verification
verification_request['face'] = {
    'proof'             :   base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode()
        }
#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(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    'additional_proof'      : base64.b64encode(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    'name'              : "",
    'dob'                : "",
    'document_number'  : "",
    'expiry_date'          : "",
    'issue_date'          : "",
    'fetch_enhanced_data'       : "1",
    'supported_types'    : ['id_card','passport']
}
#document offsite verification with OCR
verification_request['document'] = {
    'proof'                : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    'additional_proof'      : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    '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(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    'additional_proof'      : base64.b64encode(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    '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 without OCR
verification_request['document'] = {
    'proof'                : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    'additional_proof'      : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    '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(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    'additional_proof'      : base64.b64encode(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    'name'              : "",
    'dob'                : "",
    'gender'                : "",
    'document_number'  : "",
    'expiry_date'          : "",
    'issue_date'          : "",
    'fetch_enhanced_data'       : "1",
    'supported_types'    : ['id_card','passport']
}
#document two offsite verification with OCR
verification_request['document_two'] = {
    'proof'                : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    'additional_proof'      : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    '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(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    'additional_proof'      : base64.b64encode(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    '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 without OCR
verification_request['document_two'] = {
    'proof'                : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    'additional_proof'      : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    '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(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    'name'                : "",
    'full_address'          : "",
    'address_fuzzy_match'  : '1',
    'issue_date'            : "",
    'supported_types'      : ['utility_bill','passport','bank_statement']
}
#address offsite verification with OCR
verification_request['address'] = {
    'proof'                  :   base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    '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(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg').read()).decode(),
    '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 without OCR
verification_request['address'] = {
    'proof'                  :   base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    '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(urllib.request.urlopen('https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-consent-document.jpg').read()).decode(),
    'text'              : 'some text for consent verificaiton',
    'supported_types'  : ['handwritten','printed']
}
#consent offsite verification
verification_request['consent'] = {
    'proof'              : base64.b64encode(urllib.request.urlopen('https://shuftipro.com/wp-content/uploads/facialbiometric.mp4').read()).decode(),
    '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'] = {
    'name'      :   {
        'first_name'     : '',
        'last_name'      : ''
    }
}
# 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
secret_key_new = hashlib.sha256(secret_key.encode()).hexdigest()
calculated_signature = hashlib.sha256(f"{response.content.decode()}{secret_key_new}".encode()).hexdigest()

# get Shufti Pro Signature
sp_signature = response.headers.get('Signature',"")

# Convert json string to json object
json_response = json.loads((response.content))

if sp_signature == calculated_signature:
    print(json_response)
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"
#offsite sample video
SAMPLE_VIDEO         =  "https://shuftipro.com/wp-content/uploads/facialbiometric.mp4"
#document offsite sample image
SAMPLE_DOCUMENT_IMAGE   =  "https://raw.githubusercontent.com/shuftipro/RESTful-API-v1.3/master/assets/real-id-card.jpg"
#address offsite sample image
SAMPLE_ADDRESS_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 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": "",
    #what kind of proofs will be provided to Shufti Pro for verification?
    "verification_mode": "any",
    #allow end-user to upload verification proofs if the webcam is not accessible
    "allow_offline": "1",
    #allow end-user to capture photos/videos with the camera only.
    "allow_offline": "0",
    #allow end-user to upload real-time or already catured proofs
    "allow_online": "1",
    #allow end-user to upload already captured images or videos.
    "allow_online": "0",
    #privacy policy screen will be shown to end-user
    "show_privacy_policy": "1",
    #privacy policy screen will not be shown to end-user
    "show_privacy_policy": "0",
    #verification results screen will be shown to end-user
    "show_results": "1",
    #verification results screen will not be shown to end-user
    "show_results": "0",
    #consent screen will be shown to end-user
    "show_consent": "1",
    #consent screen will not be shown to end-user
    "show_consent": "0",
    #User can send Feedback
    "show_feedback_form": "1",
    #User cannot send Feedback
    "show_feedback_form": "0",
}
#face onsite verification
verification_request['face'] = {}
#face offsite verification
verification_request["face"] = {
    'proof': Base64.encode64(URI.open(SAMPLE_FACE_IMAGE).read),
}
#face offsite verification
verification_request["face"] = {
    'proof': Base64.encode64(URI.open(SAMPLE_VIDEO).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(URI.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 with OCR
verification_request['document'] = {
    'proof': Base64.encode64(URI.open(SAMPLE_VIDEO).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(URI.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 offsite verification without OCR
verification_request['document'] = {
    'proof': Base64.encode64(URI.open(SAMPLE_VIDEO).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(URI.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 with OCR
verification_request['document_two'] = {
    'proof': Base64.encode64(URI.open(SAMPLE_VIDEO).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(URI.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",
}
#document two offsite verification without OCR
verification_request['document_two'] = {
    'proof': Base64.encode64(URI.open(SAMPLE_VIDEO).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(URI.open(SAMPLE_ADDRESS_IMAGE).read),
    'name': "",
    'full_address': "",
    'address_fuzzy_match': '1',
    'issue_date': "",
    'supported_types': ['utility_bill','passport','bank_statement']
}
#address offsite verification with OCR
verification_request['address'] = {
    'proof': Base64.encode64(URI.open(SAMPLE_VIDEO).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(URI.open(SAMPLE_ADDRESS_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']
}
#address offsite verification without OCR
verification_request['address'] = {
    'proof': Base64.encode64(URI.open(SAMPLE_VIDEO).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(URI.open(SAMPLE_CONSENT_IMAGE).read),
    'text': 'some text for consent verificaiton',
    'supported_types': ['handwritten','printed']
}
#consent offsite verification
verification_request['consent'] = {
    'proof': Base64.encode64(URI.open(SAMPLE_VIDEO).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'] = {
    'name':   {
        'first_name': '',
        'full_name': ''
    }
}

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(',') : ""
secret_key_encoded = Digest::SHA256.hexdigest(SECRET_KEY)
calculated_signature = Digest::SHA256.hexdigest(response_data + secret_key_encoded)
if sp_signature == calculated_signature
    puts response_data
else
    puts "Invalid signature"
end