1. Go to this page and download the library: Download devneok/neokpay-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/ */
devneok / neokpay-php example snippets
use Neok\Pay\Client;
use Neok\Pay\ClientConfig;
$factory = new \GuzzleHttp\Psr7\HttpFactory();
$client = new Client(
new ClientConfig(apiKey: (string) getenv('NEOKPAY_API_KEY')),
new \GuzzleHttp\Client(['timeout' => 15, 'connect_timeout' => 5]),
$factory,
$factory,
);
$payment = $client->payments()->retrieve($checkout->payment->id);
if ($payment->isPaid()) {
// Fulfil only after server-confirmed paid state or a verified webhook.
}
use Neok\Pay\Webhooks\WebhookVerifier;
$event = (new WebhookVerifier())->verify(
rawBody: file_get_contents('php://input'),
signatureHeader: $_SERVER['HTTP_X_NEOKPAY_SIGNATURE'] ?? '',
secret: (string) getenv('NEOKPAY_WEBHOOK_SECRET'),
);
try {
$payment = $client->payments()->retrieve($storedPaymentId);
} catch (\Neok\Pay\Exceptions\AuthenticationException $e) {
// Check server-issued credentials privately; never print/log them.
} catch (\Neok\Pay\Exceptions\RateLimitException $e) {
// Back off before retrying.
} catch (\Neok\Pay\Exceptions\TransportException $e) {
// Retry safely; keep the same idempotency key for checkout retries.
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.