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 session for embedding in web page as iframe
- createLiveMobile() : array<string|int, mixed>
- Create a DocuPass Live Mobile verification session for users to open on mobile phone
- createMobile() : array<string|int, mixed>
- Create a DocuPass session for users to open on mobile phone, or embedding in mobile app
- createRedirection() : array<string|int, mixed>
- Create a DocuPass session for users to open in any browser
- 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.
- 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.
- 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. For example, "PD" would accept both passport and drivers license.
- setCallbackImage() : void
- Enable/Disable returning user uploaded document and face image in callback, and image data format.
- setCallbackURL() : void
- Set server-side callback URL to receive verification results
- 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
- 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
- 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.
- 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, "return_type" => 1, "qr_color" => "", "qr_bgcolor" => "", "qr_size" => "", "qr_margin" => "", "welcomemessage" => "", "nobranding" => "", "logo" => "", "language" => "", "biometric_threshold" => 0.4, "reusable" => false, "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 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 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 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 session for users to open in any browser
public
createRedirection() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —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/Disable Document Authentication
- $module : mixed = 2
-
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
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/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 —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/Disable Vault
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. For example, "PD" would accept both passport and drivers license.
public
restrictType([string $documentType = "DIP" ]) : void
Parameters
- $documentType : string = "DIP"
-
P: Passport, D: Driver's License, I: Identity Card
Return values
void —setCallbackImage()
Enable/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 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 —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
-
Language Code: en fr nl de es zh-TW zh-CN
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 —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 —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/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 —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