PHP code example of shaggyrec / sumsubphp
1. Go to this page and download the library: Download shaggyrec/sumsubphp library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once ('vendor/autoload.php' );
shaggyrec / sumsubphp example snippets
use Shaggyrec \SumSubClient \SumSubClient ;
$sumSub = SumSubClient::getInstance('App Token' , 'APP Secret' );
$sumSub->getAccessToken('userId' , 'levelName' );
$sumSub->getAccessToken('userId' , 'levelName' );
$sumSub->createApplicant(
'externalUserId' ,
'phone' ,
'email' ,
new FixedInfo(
[
firstName => 'firstName' ,
lastName => '' ,
middleName => '' ,
firstNameEn => '' ,
lastNameEn => '' ,
middleNameEn => '' ,
legalName => '' ,
gender => 'M' ,
dob => '' ,
placeOfBirth => '' ,
country => '' ,
nationality => '' ,
addresses => [],
],
)
'levelName' ,
);
$sumSub->changeLevel('applicantId' , 'levelName' );
use Shaggyrec \Sumsubphp \DTO \FileMetadata ;
$sumSub->addDoc(
'$applicantId' ,
new FileMetadata(
[
'idDocType' => 'PASSPORT' ,
'country' => 'USA' ,
'firstName' => '' ,
'middleName' => '' ,
'lastName' => '' ,
'issuedDate' => '2015-01-02' ,
'number' => '40111234567' ,
'dob' => '2000-02-01' ,
'placeOfBirth' => 'London'
],
$content,
);
$sumSub->getApplicantById('applicantId' );
$sumSub->getApplicantByExternalUserId('yourId' );
use Shaggyrec \Sumsubphp \DTO \FixedInfo ;
$sumSub->changeProvidedInfo(
'applicantId' ,
new FixedInfo(
[
firstName => 'firstName' ,
lastName => '' ,
middleName => '' ,
firstNameEn => '' ,
lastNameEn => '' ,
middleNameEn => '' ,
legalName => '' ,
gender => 'M' ,
dob => '' ,
placeOfBirth => '' ,
country => '' ,
nationality => '' ,
addresses => [],
],
),
);
$sumSub->getApplicantStatus('applicantId' );
$sumSub->getRequiredIdDocsStatus('applicantId' );
$sumSub->requestCheck(
'applicantId' ,
'reason' ,
);
$sumSub->getDocumentImage(
'inspectionId' ,
'imageId'
);
$sumSub->addToBlacklist('applicantId' , 'note' )
$sumSub->resetSingleVerificationStep('applicantId' , 'step' );
$sumSub->resetApplicant('applicantId' );
$sumSub->setRiskLevel(
'applicantId' ,
'riskLevel' ,
'$comment' ,
);
$sumSub->markImageDeleted('inspectionId' , 'imageId' );
$sumSub->addTags('applicantId' , ['tag1' , 'tagg2]);
use Shaggyrec \SumSubClient \WebhookHandler ;
...
WebhookHandler::verifySender('x-payload-digest header' , $webhookBody, 'secret key' )
$webhookResponse = WebhookHandler::handle($webhookBody);
use Shaggyrec \SumSubClient \WebhookHandler ;
...
$webhookBody;
$webhookResponse = WebhookHandler::handleWithVerification($webhookBody, 'SECRET KEY' );