1. Go to this page and download the library: Download zerokyc/zkp-sdk-php 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/ */
zerokyc / zkp-sdk-php example snippets
use ZeroKYC\Idempotency\IdempotencyKey;
use ZeroKYC\Invoice\CreateInvoiceRequest;
use ZeroKYC\ZeroKYC;
$zkp = new ZeroKYC([
'api_key' => getenv('ZEROKYC_API_KEY'), // pk_test_... (sandbox) / pk_live_... (production)
'environment' => 'sandbox',
]);
$response = $zkp->createInvoice(
CreateInvoiceRequest::make('19.90', 'USD')
->withOrderId('INV-1042')
->withDescription('VPS plan: starter'),
IdempotencyKey::make('myshop', 'invoice', '1042'), // stable per local order
);
header('Location: ' . $response->invoice->checkoutUrl);
use ZeroKYC\Exception\WebhookVerificationException;
try {
$event = $zkp->verifyWebhook(
file_get_contents('php://input'), // exact raw body
$_SERVER['HTTP_X_ZKP_SIGNATURE'] ?? '',
);
} catch (WebhookVerificationException $e) {
http_response_code(400);
exit;
}
if ($event->isPaymentConfirmed()) {
// match invoice id + amount + asset against the local order, then activate
}