SDKs
Official libraries wrap authentication, requests, errors, and webhook verification so you write less boilerplate.
Node.js
Install
npm install @paykh/sdk-nodeUsage
import { PayKH } from '@paykh/sdk-node';
const paykh = new PayKH(process.env.PAYKH_API_KEY); // bk_test_… / bk_live_…
const payment = await paykh.payments.create({
amount: '1.50',
currency: 'USD',
reference_id: 'order_1001',
});
console.log(payment.qr_string);Webhook verification:
Verify a webhook
import { verifyWebhook, constructEvent } from '@paykh/sdk-node';
const event = constructEvent(rawBody, signatureHeader, process.env.PAYKH_WEBHOOK_SECRET);
if (event.type === 'payment.completed') { /* fulfil */ }PHP
Install
composer require paykh/sdk-phpUsage
<?php
use PayKH\Client;
$paykh = new Client(getenv('PAYKH_API_KEY'));
$payment = $paykh->payments->create([
'amount' => '1.50',
'currency' => 'USD',
'reference_id' => 'order_1001',
]);
echo $payment['qr_string'];Python
Install
pip install paykhUsage
from paykh import PayKH
paykh = PayKH(api_key=os.environ["PAYKH_API_KEY"])
payment = paykh.payments.create(
amount="1.50",
currency="USD",
reference_id="order_1001",
)
print(payment["qr_string"])ℹ️ Prefer HTTP?
Every SDK is a thin wrapper over the REST API. If your language isn’t listed, the API reference and a Postman collection have you covered.