PHP SDK Reference

DocuPass

Table of Contents

$apiendpoint  : mixed
$apikey  : mixed
$config  : mixed
$defaultconfig  : mixed
$urlRegex  : mixed
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()  : null
Validate the document to check whether the document is authentic and has not been tampered
enableDualsideCheck()  : null
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()  : null
Whether users will be required to submit a selfie photo or record selfie video for facial verification.
enableVault()  : null
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()  : null
Hide all branding logo
init()  : null
Initialize DocuPass API with an API key, company name and optional region (US, EU)
resetConfig()  : null
Reset all API configurations except API key and region.
restrictCountry()  : null
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()  : null
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()  : null
Only accept document of specified types. For example, "PD" would accept both passport and drivers license.
setCallbackImage()  : null
Enable/Disable returning user uploaded document and face image in callback, and image data format.
setCallbackURL()  : null
Set server-side callback URL to receive verification results
setCustomID()  : null
Set a custom user identifier string, this will be returned in the callback
setLanguage()  : null
DocuPass automatically detects user device language and display corresponding language. Set this parameter to override automatic language detection.
setLogo()  : null
Replace footer logo with your own logo
setMaxAttempt()  : null
Set max verification attempt per user
setQRCodeFormat()  : null
Configure QR code generated for DocuPass Mobile and Live Mobile
setRedirectionURL()  : null
Redirect client browser to set URLs after verification
setWelcomeMessage()  : null
Display a custom message to the user in the beginning of verification
validate()  : bool
Validate a data received through DocuPass Callback against DocuPass Server to prevent request spoofing
verifyAddress()  : null
Check if supplied address matches with document.
verifyAge()  : null
Check if the document holder is aged between the given range.
verifyDOB()  : null
Check if supplied date of birth matches with document.
verifyDocumentNumber()  : null
Check if supplied document or personal number matches with document.
verifyExpiry()  : null
Check if the document is still valid based on its expiry date.
verifyName()  : null
Check if supplied name matches with document.
verifyPostcode()  : null
Check if supplied postcode matches with document.
create()  : mixed

Properties

$apiendpoint

private mixed $apiendpoint = ""

$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" => "", "return_documentimage" => "", "return_faceimage" => "", "return_type" => "", "qr_color" => "", "qr_bgcolor" => "", "qr_size" => "", "qr_margin" => "", "welcomemessage" => "", "nobranding" => "", "logo" => "", "language" => "", "biometric_threshold" => 0.4)

$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

createIframe()

Create a DocuPass session for embedding in web page as iframe

public createIframe() : array<string|int, mixed>
Tags
throws
Exception
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
throws
Exception
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
throws
Exception
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
throws
Exception
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 ]) : null
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
throws
Exception
Return values
null

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 ]) : null
Parameters
$enabled : bool = false
Return values
null

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 ]) : null
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
throws
Exception
Return values
null

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 ]) : null
Parameters
$enabled : bool = true

Enable/Disable Vault

Return values
null

Hide all branding logo

public hideBrandingLogo([bool $hide = false ]) : null
Parameters
$hide : bool = false
Return values
null

init()

Initialize DocuPass API with an API key, company name and optional region (US, EU)

public init(string $apikey[, string $companyName = "My Company Name" ][, string $region = "US" ]) : null
Parameters
$apikey : string

You API key

$companyName : string = "My Company Name"

Your company name

$region : string = "US"

US/EU

Return values
null

resetConfig()

Reset all API configurations except API key and region.

public resetConfig() : null
Return values
null

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" ]) : null
Parameters
$countryCodes : string = "US,CA,UK"

ISO ALPHA-2 Country Code separated by comma

Return values
null

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" ]) : null
Parameters
$states : string = "CA,TX"

State full name or abbreviation separated by comma

Return values
null

restrictType()

Only accept document of specified types. For example, "PD" would accept both passport and drivers license.

public restrictType([string $documentType = "DIP" ]) : null
Parameters
$documentType : string = "DIP"

P: Passport, D: Driver's License, I: Identity Card

Return values
null

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 ]) : null
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
null

setCallbackURL()

Set server-side callback URL to receive verification results

public setCallbackURL([string $url = "https://www.example.com/docupass_callback.php" ]) : null
Parameters
$url : string = "https://www.example.com/docupass_callback.php"

Callback URL

Tags
throws
Exception
Return values
null

setCustomID()

Set a custom user identifier string, this will be returned in the callback

public setCustomID([string $customID = "12345" ]) : null
Parameters
$customID : string = "12345"

A string used to identify your customer internally

Return values
null

setLanguage()

DocuPass automatically detects user device language and display corresponding language. Set this parameter to override automatic language detection.

public setLanguage(string $language) : null
Parameters
$language : string

Language Code: en fr nl de es zh-TW zh-CN

Return values
null

Replace footer logo with your own logo

public setLogo([string $url = "https://docupass.app/asset/logo1.png" ]) : null
Parameters
$url : string = "https://docupass.app/asset/logo1.png"

Logo URL

Return values
null

setMaxAttempt()

Set max verification attempt per user

public setMaxAttempt([int $max_attempt = 1 ]) : null
Parameters
$max_attempt : int = 1

1 to 10

Tags
throws
Exception
Return values
null

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 ]) : null
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
throws
Exception
Return values
null

setRedirectionURL()

Redirect client browser to set URLs after verification

public setRedirectionURL([string $successURL = "https://www.example.com/success.php" ][, string $failURL = "https://www.example.com/failed.php" ]) : null
Parameters
$successURL : string = "https://www.example.com/success.php"

Redirection URL when verification succeed

$failURL : string = "https://www.example.com/failed.php"

Redirection URL when verification failed

Tags
throws
Exception
Return values
null

setWelcomeMessage()

Display a custom message to the user in the beginning of verification

public setWelcomeMessage(string $message) : null
Parameters
$message : string

Plain text string

Return values
null

validate()

Validate a data received through DocuPass Callback against DocuPass Server to prevent request spoofing

public validate(mixed $reference, mixed $hash) : bool
Parameters
$reference : mixed
$hash : mixed
Tags
throws
Exception
Return values
bool

verifyAddress()

Check if supplied address matches with document.

public verifyAddress([string $address = "123 Sample St, California, US" ]) : null
Parameters
$address : string = "123 Sample St, California, US"

Address requiring validation

Return values
null

verifyAge()

Check if the document holder is aged between the given range.

public verifyAge([string $ageRange = "18-99" ]) : null
Parameters
$ageRange : string = "18-99"

Age range, example: 18-40

Tags
throws
Exception
Return values
null

verifyDOB()

Check if supplied date of birth matches with document.

public verifyDOB([string $dob = "1990/01/01" ]) : null
Parameters
$dob : string = "1990/01/01"

Date of birth in YYYY/MM/DD

Tags
throws
Exception
Return values
null

verifyDocumentNumber()

Check if supplied document or personal number matches with document.

public verifyDocumentNumber([string $documentNumber = "X1234567" ]) : null
Parameters
$documentNumber : string = "X1234567"

Document or personal number requiring validation

Tags
throws
Exception
Return values
null

verifyExpiry()

Check if the document is still valid based on its expiry date.

public verifyExpiry([bool $enabled = false ]) : null
Parameters
$enabled : bool = false

Enable/Disable expiry check

Return values
null

verifyName()

Check if supplied name matches with document.

public verifyName([string $fullName = "ELON MUSK" ]) : null
Parameters
$fullName : string = "ELON MUSK"

Full name requiring validation

Tags
throws
Exception
Return values
null

verifyPostcode()

Check if supplied postcode matches with document.

public verifyPostcode([string $postcode = "90001" ]) : null
Parameters
$postcode : string = "90001"

Postcode requiring validation

Return values
null

create()

private create(mixed $docupass_module) : mixed
Parameters
$docupass_module : mixed
Return values
mixed

Search results