1. Go to this page and download the library: Download djstar7/kpay-sdk 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/ */
djstar7 / kpay-sdk example snippets
use Kpay\Sdk\KpayClient;
$kpay = new KpayClient(
baseUrl: 'https://admin.kpay.site', // sans /api
apiKey: getenv('KPAY_API_KEY'),
secretKey: getenv('KPAY_SECRET_KEY'),
gatewaySecret: getenv('KPAY_GATEWAY_SECRET'),
maxDuration: 300, // SEUL paramètre configurable (s)
);
$res = $kpay->initPayment([
'amount' => 5000,
'externalId' => 'ORDER-123',
'returnUrl' => 'https://monsite.com/retour',
'cancelUrl' => 'https://monsite.com/annule',
]);
// → rediriger vers $res['gatewayUrl']