PHP code example of verifymycontent / identity-check
1. Go to this page and download the library: Download verifymycontent/identity-check 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');
/* Start to develop here. Best regards https://php-download.com/ */
verifymycontent / identity-check example snippets
= new \VerifyMyContent\IdentityCheck\VMC(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();
try {
$response = $vmc->createIdentityVerification([
"customer" => [
"id" => "YOUR-CUSTOMER-UNIQUE-ID",
"email" => "[email protected]",
"phone" => "+4412345678"
],
"redirect_uri" => "https://example.com/callback",
"webhook" => "https://example.com/webhook",
]
);
// save $response->id if you want to save the verification of your customer
// redirect user to check identity
header("Location: {$response->redirect_uri}");
} catch (Exception $e) {
echo $e;
}
= new \VerifyMyContent\IdentityCheck\VMC(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
//$vmc->useSandbox();
$response = $vmc->getIdentityVerification("YOUR-IDENTITY-VERIFICATION-ID");
// Printing current status
echo "Status: {$response->status}";
= new \VerifyMyContent\IdentityCheck\VMC(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
$jsonPayload = '{
"id": "ABC-123-5678-ABC",
"customer_id": "customer_id",
"status": "pending"
}';
$data = json_decode($jsonPayload, true);
$webhook = $vmc->parseIdentityVerificationWebhookPayload($data);
// Printing current status
echo "Status: {$webhook->status} received from verification {$webhook->id}";
// This is how you can check if the identity verification is approved.
if ($webhook->status === \VerifyMyContent\SDK\IdentityVerification\IdentityVerificationStatus::APPROVED) {
// do your thing
}
= new \VerifyMyContent\IdentityCheck\VMC(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
$vmc->useSandbox();
try{
$vmc->addAllowedRedirectUrls(["https://teste1.com", "https://teste2.com"]);
echo "Urls replaced with success";
}catch(Exception $e){
echo "Error";
var_export($e);
}
= new \VerifyMyContent\IdentityCheck\VMC(getenv('VMC_API_KEY'), getenv('VMC_API_SECRET'));
$vmc->useSandbox();
try{
$vmc->removeAllowedRedirectUrls(["https://teste1.com"]);
echo "Urls removed with success";
}catch(Exception $e){
echo "Error";
var_export($e);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.