DocuPass
Table of Contents
- $apiendpoint : mixed
- $apikey : mixed
- $config : mixed
- $defaultconfig : mixed
- $throwError : mixed
- $urlRegex : mixed
- __construct() : void
- Initialize DocuPass API with an API key, company name and optional region (US, EU)
- createIframe() : array<string|int, mixed>
- Create a DocuPass identity verification session for embedding in web page as iframe
- createLiveMobile() : array<string|int, mixed>
- Create a DocuPass Live Mobile identity verification session for users to open on mobile phone
- createMobile() : array<string|int, mixed>
- Create a DocuPass identity verification session for users to open on mobile phone, or embedding in mobile app
- createRedirection() : array<string|int, mixed>
- Create a DocuPass identity verification session for users to open in any browser
- createSignature() : array<string|int, mixed>
- Create a DocuPass signature session for user to review and sign legal document without identity verification
- enableAMLCheck() : void
- Check document holder's name and document number against ID Analyzer AML Database for sanctions, crimes and PEPs.
- enableAMLStrictMatch() : void
- By default, entities with identical name or document number will be considered a match even though their birthday or nationality may be unknown. Enable this parameter to reduce false-positives by only matching entities with exact same nationality and birthday.
- enableAuthentication() : void
- Validate the document to check whether the document is authentic and has not been tampered
- enableDualsideCheck() : void
- Check if the names, document number and document type matches between the front and the back of the document when performing dual-side scan. If any information mismatches error 14 will be thrown.
- enableFaceVerification() : void
- Whether users will be required to submit a selfie photo or record selfie video for facial verification.
- enablePhoneVerification() : void
- Whether to ask user to enter a phone number for verification, DocuPass supports both mobile or landline number verification. Verified phone number will be returned in callback JSON.
- enableVault() : void
- Save document image and parsed information in your secured vault. You can list, search and update document entries in your vault through Vault API or web portal.
- generateContract() : void
- Generate legal document using data from user uploaded ID
- hideBrandingLogo() : void
- Hide all branding logo
- resetConfig() : void
- Reset all API configurations except API key and region.
- restrictCountry() : void
- Check if the document was issued by specified countries, if not error code 10 will be thrown. Separate multiple values with comma. For example "US,CA" would accept documents from United States and Canada.
- restrictState() : void
- Check if the document was issued by specified state, if not error code 11 will be thrown. Separate multiple values with comma. For example "CA,TX" would accept documents from California and Texas.
- restrictType() : void
- Only accept document of specified types.
- setAMLDatabase() : void
- Specify the source databases to perform AML check, if left blank, all source databases will be checked. Separate each database code with comma, for example: un_sc,us_ofac. For full list of source databases and corresponding code visit AML API Overview.
- setCallbackImage() : void
- Enable or disable returning user uploaded document and face image in callback, and image data format.
- setCallbackURL() : void
- Set server-side callback/webhook URL to receive verification results
- setCustomHTML() : void
- Replace DocuPass page content with your own HTML and CSS, you can download the HTML/CSS template from DocuPass API Reference page
- setCustomID() : void
- Set a custom string that will be sent back to your server's callback URL, and appended to redirection URLs as a query string. It is useful for identifying your user within your database. This value will be stored under docupass_customid under Vault.
- setLanguage() : void
- DocuPass automatically detects user device language and display corresponding language. Set this parameter to override automatic language detection.
- setLogo() : void
- Replace footer logo with your own logo
- setMaxAttempt() : void
- Set max verification attempt per user
- setParameter() : void
- Set an API parameter and its value, this function allows you to set any API parameter without using the built-in functions
- setQRCodeFormat() : void
- Configure QR code generated for DocuPass Mobile and Live Mobile
- setRedirectionURL() : void
- Redirect client browser to set URLs after verification. DocuPass reference code and customid will be appended to the end of URL, e.g. https://www.example.com/success.php?reference=XXXXXXXX&customid=XXXXXXXX
- setReusable() : void
- Enabling this parameter will allow multiple users to verify their identity through the same URL, a new DocuPass reference code will be generated for each user automatically.
- setWelcomeMessage() : void
- Display a custom message to the user in the beginning of verification
- signContract() : void
- Have user review and sign autofilled legal document after successful identity verification
- smsContractLink() : void
- DocuPass will send SMS to this number containing DocuPass link to review and sign legal document.
- smsVerificationLink() : void
- DocuPass will send SMS to this number containing DocuPass link to perform identity verification, the number provided will be automatically considered as verified if user completes identity verification. If an invalid or unreachable number is provided error 1050 will be thrown. You should add your own thresholding mechanism to prevent abuse as you will be charged 1 quota to send the SMS.
- throwAPIException() : void
- Whether an exception should be thrown if API response contains an error message
- validate() : bool
- Validate a data received through DocuPass Callback against DocuPass Server to prevent request spoofing
- verifyAddress() : void
- Check if supplied address matches with document.
- verifyAge() : void
- Check if the document holder is aged between the given range.
- verifyDOB() : void
- Check if supplied date of birth matches with document.
- verifyDocumentNumber() : void
- Check if supplied document or personal number matches with document.
- verifyExpiry() : void
- Check if the document is still valid based on its expiry date.
- verifyName() : void
- Check if supplied name matches with document.
- verifyPhone() : void
- DocuPass will attempt to verify this phone number as part of the identity verification process, both mobile or landline are supported, users will not be able to enter their own numbers or change the provided number.
- verifyPostcode() : void
- Check if supplied postcode matches with document.
- create() : array<string|int, mixed>
Properties
$apiendpoint
private
mixed
$apiendpoint
= ""
$apikey
private
mixed
$apikey
$config
private
mixed
$config
$defaultconfig
private
mixed
$defaultconfig
= array("companyname" => "", "callbackurl" => "", "biometric" => 0, "authenticate_minscore" => 0, "authenticate_module" => 2, "maxattempt" => 1, "documenttype" => "", "documentcountry" => "", "documentregion" => "", "dualsidecheck" => false, "verify_expiry" => false, "verify_documentno" => "", "verify_name" => "", "verify_dob" => "", "verify_age" => "", "verify_address" => "", "verify_postcode" => "", "successredir" => "", "failredir" => "", "customid" => "", "vault_save" => true, "return_documentimage" => true, "return_faceimage" => true, "return_type" => 1, "qr_color" => "", "qr_bgcolor" => "", "qr_size" => "", "qr_margin" => "", "welcomemessage" => "", "nobranding" => "", "logo" => "", "language" => "", "biometric_threshold" => 0.4, "reusable" => false, "aml_check" => false, "aml_strict_match" => false, "aml_database" => "", "phoneverification" => false, "verify_phone" => "", "sms_verification_link" => "", "customhtmlurl" => "", "contract_generate" => "", "contract_sign" => "", "contract_format" => "", "contract_prefill_data" => "", "sms_contract_link" => "", "client" => 'php-sdk')
$throwError
private
mixed
$throwError
= false
$urlRegex
private
mixed
$urlRegex
= "#(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))#iS"
Methods
__construct()
Initialize DocuPass API with an API key, company name and optional region (US, EU)
public
__construct(string $apikey[, string $companyName = "My Company Name" ][, string $region = "US" ]) : void
Parameters
- $apikey : string
-
You API key
- $companyName : string = "My Company Name"
-
Your company name
- $region : string = "US"
-
US/EU
Tags
Return values
void —createIframe()
Create a DocuPass identity verification session for embedding in web page as iframe
public
createIframe() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —createLiveMobile()
Create a DocuPass Live Mobile identity verification session for users to open on mobile phone
public
createLiveMobile() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —createMobile()
Create a DocuPass identity verification session for users to open on mobile phone, or embedding in mobile app
public
createMobile() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —createRedirection()
Create a DocuPass identity verification session for users to open in any browser
public
createRedirection() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —createSignature()
Create a DocuPass signature session for user to review and sign legal document without identity verification
public
createSignature(string $templateId[, string $format = "PDF" ][, mixed $prefillData = array() ]) : array<string|int, mixed>
Parameters
- $templateId : string
-
Contract Template ID displayed under web portal
- $format : string = "PDF"
-
Output file format: PDF, DOCX or HTML
- $prefillData : mixed = array()
-
Associative array or JSON string, to autofill dynamic fields in contract template.
Tags
Return values
array<string|int, mixed> —enableAMLCheck()
Check document holder's name and document number against ID Analyzer AML Database for sanctions, crimes and PEPs.
public
enableAMLCheck([bool $enabled = false ]) : void
Parameters
- $enabled : bool = false
-
Enable or disable AML/PEP check
Return values
void —enableAMLStrictMatch()
By default, entities with identical name or document number will be considered a match even though their birthday or nationality may be unknown. Enable this parameter to reduce false-positives by only matching entities with exact same nationality and birthday.
public
enableAMLStrictMatch([bool $enabled = false ]) : void
Parameters
- $enabled : bool = false
-
Enable or disable AML strict match mode
Return values
void —enableAuthentication()
Validate the document to check whether the document is authentic and has not been tampered
public
enableAuthentication([bool $enabled = false ][, mixed $module = 2 ][, float $minimum_score = 0.3 ]) : void
Parameters
- $enabled : bool = false
-
Enable or disable Document Authentication
- $module : mixed = 2
-
Authentication Module: "1", "2" or "quick"
- $minimum_score : float = 0.3
-
Minimum score to pass verification
Tags
Return values
void —enableDualsideCheck()
Check if the names, document number and document type matches between the front and the back of the document when performing dual-side scan. If any information mismatches error 14 will be thrown.
public
enableDualsideCheck([bool $enabled = false ]) : void
Parameters
- $enabled : bool = false
-
Enable or disable dual-side information check
Return values
void —enableFaceVerification()
Whether users will be required to submit a selfie photo or record selfie video for facial verification.
public
enableFaceVerification([bool $enabled = false ][, int $verification_type = 1 ][, float $threshold = 0.4 ]) : void
Parameters
- $enabled : bool = false
-
Enable or disable Facial Biometric Verification
- $verification_type : int = 1
-
1 for photo verification, 2 for video verification
- $threshold : float = 0.4
-
Minimum confidence score required to pass verification, value between 0 to 1
Tags
Return values
void —enablePhoneVerification()
Whether to ask user to enter a phone number for verification, DocuPass supports both mobile or landline number verification. Verified phone number will be returned in callback JSON.
public
enablePhoneVerification([bool $enabled = false ]) : void
Parameters
- $enabled : bool = false
-
Enable or disable user phone verification
Return values
void —enableVault()
Save document image and parsed information in your secured vault. You can list, search and update document entries in your vault through Vault API or web portal.
public
enableVault([bool $enabled = true ]) : void
Parameters
- $enabled : bool = true
-
Enable or disable Vault
Return values
void —generateContract()
Generate legal document using data from user uploaded ID
public
generateContract(string $templateId[, string $format = "PDF" ][, mixed $prefillData = array() ]) : void
Parameters
- $templateId : string
-
Contract Template ID displayed under web portal
- $format : string = "PDF"
-
Output file format: PDF, DOCX or HTML
- $prefillData : mixed = array()
-
Associative array or JSON string, to autofill dynamic fields in contract template.
Tags
Return values
void —hideBrandingLogo()
Hide all branding logo
public
hideBrandingLogo([bool $hide = false ]) : void
Parameters
- $hide : bool = false
Return values
void —resetConfig()
Reset all API configurations except API key and region.
public
resetConfig() : void
Return values
void —restrictCountry()
Check if the document was issued by specified countries, if not error code 10 will be thrown. Separate multiple values with comma. For example "US,CA" would accept documents from United States and Canada.
public
restrictCountry([string $countryCodes = "US,CA,UK" ]) : void
Parameters
- $countryCodes : string = "US,CA,UK"
-
ISO ALPHA-2 Country Code separated by comma
Return values
void —restrictState()
Check if the document was issued by specified state, if not error code 11 will be thrown. Separate multiple values with comma. For example "CA,TX" would accept documents from California and Texas.
public
restrictState([string $states = "CA,TX" ]) : void
Parameters
- $states : string = "CA,TX"
-
State full name or abbreviation separated by comma
Return values
void —restrictType()
Only accept document of specified types.
public
restrictType([string $documentType = "DIP" ]) : void
Parameters
- $documentType : string = "DIP"
-
P: Passport, D: Driver's License, I: Identity Card. For example, "PD" would only accept passport and drivers license but not ID card.
Return values
void —setAMLDatabase()
Specify the source databases to perform AML check, if left blank, all source databases will be checked. Separate each database code with comma, for example: un_sc,us_ofac. For full list of source databases and corresponding code visit AML API Overview.
public
setAMLDatabase([string $databases = "au_dfat,ca_dfatd,ch_seco,eu_fsf,fr_tresor_gels_avoir,gb_hmt,ua_sfms,un_sc,us_ofac,eu_cor,eu_meps,global_politicians,interpol_red" ]) : void
Parameters
- $databases : string = "au_dfat,ca_dfatd,ch_seco,eu_fsf,fr_tresor_gels_avoir,gb_hmt,ua_sfms,un_sc,us_ofac,eu_cor,eu_meps,global_politicians,interpol_red"
-
Database codes separated by comma
Return values
void —setCallbackImage()
Enable or disable returning user uploaded document and face image in callback, and image data format.
public
setCallbackImage([bool $return_documentimage = true ][, bool $return_faceimage = true ][, int $return_type = 1 ]) : void
Parameters
- $return_documentimage : bool = true
-
Return document image in callback data
- $return_faceimage : bool = true
-
Return face image in callback data
- $return_type : int = 1
-
Image type: 0=base64, 1=url
Return values
void —setCallbackURL()
Set server-side callback/webhook URL to receive verification results
public
setCallbackURL([string $url = "https://www.example.com/docupass_callback.php" ]) : void
Parameters
- $url : string = "https://www.example.com/docupass_callback.php"
-
Callback URL
Tags
Return values
void —setCustomHTML()
Replace DocuPass page content with your own HTML and CSS, you can download the HTML/CSS template from DocuPass API Reference page
public
setCustomHTML(string $url) : void
Parameters
- $url : string
-
URL pointing to your own HTML page
Return values
void —setCustomID()
Set a custom string that will be sent back to your server's callback URL, and appended to redirection URLs as a query string. It is useful for identifying your user within your database. This value will be stored under docupass_customid under Vault.
public
setCustomID([string $customID = "12345" ]) : void
Parameters
- $customID : string = "12345"
-
A string used to identify your customer internally
Return values
void —setLanguage()
DocuPass automatically detects user device language and display corresponding language. Set this parameter to override automatic language detection.
public
setLanguage(string $language) : void
Parameters
- $language : string
-
Check DocuPass API reference for language code
Return values
void —setLogo()
Replace footer logo with your own logo
public
setLogo([string $url = "https://docupass.app/asset/logo1.png" ]) : void
Parameters
- $url : string = "https://docupass.app/asset/logo1.png"
-
Logo URL
Return values
void —setMaxAttempt()
Set max verification attempt per user
public
setMaxAttempt([int $max_attempt = 1 ]) : void
Parameters
- $max_attempt : int = 1
-
1 to 10
Tags
Return values
void —setParameter()
Set an API parameter and its value, this function allows you to set any API parameter without using the built-in functions
public
setParameter(string $parameterKey, string $parameterValue) : void
Parameters
- $parameterKey : string
-
Parameter key
- $parameterValue : string
-
Parameter value
Return values
void —setQRCodeFormat()
Configure QR code generated for DocuPass Mobile and Live Mobile
public
setQRCodeFormat([string $foregroundColor = "000000" ][, string $backgroundColor = "FFFFFF" ][, int $size = 5 ][, int $margin = 1 ]) : void
Parameters
- $foregroundColor : string = "000000"
-
Image foreground color HEX code
- $backgroundColor : string = "FFFFFF"
-
Image background color HEX code
- $size : int = 5
-
Image size: 1 to 50
- $margin : int = 1
-
Image margin: 1 to 50
Tags
Return values
void —setRedirectionURL()
Redirect client browser to set URLs after verification. DocuPass reference code and customid will be appended to the end of URL, e.g. https://www.example.com/success.php?reference=XXXXXXXX&customid=XXXXXXXX
public
setRedirectionURL([string $successURL = "https://www.example.com/success.php" ][, string $failURL = "https://www.example.com/failed.php" ]) : void
Parameters
- $successURL : string = "https://www.example.com/success.php"
-
Redirection URL after verification succeeded
- $failURL : string = "https://www.example.com/failed.php"
-
Redirection URL after verification failed
Tags
Return values
void —setReusable()
Enabling this parameter will allow multiple users to verify their identity through the same URL, a new DocuPass reference code will be generated for each user automatically.
public
setReusable([bool $reusable = false ]) : void
Parameters
- $reusable : bool = false
-
Set true to allow unlimited verification for a single DocuPass session
Return values
void —setWelcomeMessage()
Display a custom message to the user in the beginning of verification
public
setWelcomeMessage(string $message) : void
Parameters
- $message : string
-
Plain text string
Return values
void —signContract()
Have user review and sign autofilled legal document after successful identity verification
public
signContract(string $templateId[, string $format = "PDF" ][, mixed $prefillData = array() ]) : void
Parameters
- $templateId : string
-
Contract Template ID displayed under web portal
- $format : string = "PDF"
-
Output file format: PDF, DOCX or HTML
- $prefillData : mixed = array()
-
Associative array or JSON string, to autofill dynamic fields in contract template.
Tags
Return values
void —smsContractLink()
DocuPass will send SMS to this number containing DocuPass link to review and sign legal document.
public
smsContractLink([string $mobileNumber = "+1333444555" ]) : void
Parameters
- $mobileNumber : string = "+1333444555"
-
Mobile number should be provided in international format such as +1333444555
Return values
void —smsVerificationLink()
DocuPass will send SMS to this number containing DocuPass link to perform identity verification, the number provided will be automatically considered as verified if user completes identity verification. If an invalid or unreachable number is provided error 1050 will be thrown. You should add your own thresholding mechanism to prevent abuse as you will be charged 1 quota to send the SMS.
public
smsVerificationLink([string $mobileNumber = "+1333444555" ]) : void
Parameters
- $mobileNumber : string = "+1333444555"
-
Mobile number should be provided in international format such as +1333444555
Return values
void —throwAPIException()
Whether an exception should be thrown if API response contains an error message
public
throwAPIException([bool $throwException = false ]) : void
Parameters
- $throwException : bool = false
Return values
void —validate()
Validate a data received through DocuPass Callback against DocuPass Server to prevent request spoofing
public
validate(string $reference, string $hash) : bool
Parameters
- $reference : string
-
DocuPass reference
- $hash : string
-
DocuPass callback hash
Tags
Return values
bool —verifyAddress()
Check if supplied address matches with document.
public
verifyAddress([string $address = "123 Sample St, California, US" ]) : void
Parameters
- $address : string = "123 Sample St, California, US"
-
Address requiring validation
Return values
void —verifyAge()
Check if the document holder is aged between the given range.
public
verifyAge([string $ageRange = "18-99" ]) : void
Parameters
- $ageRange : string = "18-99"
-
Age range, example: 18-40
Tags
Return values
void —verifyDOB()
Check if supplied date of birth matches with document.
public
verifyDOB([string $dob = "1990/01/01" ]) : void
Parameters
- $dob : string = "1990/01/01"
-
Date of birth in YYYY/MM/DD
Tags
Return values
void —verifyDocumentNumber()
Check if supplied document or personal number matches with document.
public
verifyDocumentNumber([string $documentNumber = "X1234567" ]) : void
Parameters
- $documentNumber : string = "X1234567"
-
Document or personal number requiring validation
Return values
void —verifyExpiry()
Check if the document is still valid based on its expiry date.
public
verifyExpiry([bool $enabled = false ]) : void
Parameters
- $enabled : bool = false
-
Enable or disable expiry check
Return values
void —verifyName()
Check if supplied name matches with document.
public
verifyName([string $fullName = "ELON MUSK" ]) : void
Parameters
- $fullName : string = "ELON MUSK"
-
Full name requiring validation
Return values
void —verifyPhone()
DocuPass will attempt to verify this phone number as part of the identity verification process, both mobile or landline are supported, users will not be able to enter their own numbers or change the provided number.
public
verifyPhone([string $phoneNumber = "+1333444555" ]) : void
Parameters
- $phoneNumber : string = "+1333444555"
-
Mobile or landline number should be provided in international format such as +1333444555
Return values
void —verifyPostcode()
Check if supplied postcode matches with document.
public
verifyPostcode([string $postcode = "90001" ]) : void
Parameters
- $postcode : string = "90001"
-
Postcode requiring validation
Return values
void —create()
private
create(mixed $docupass_module) : array<string|int, mixed>
Parameters
- $docupass_module : mixed