LuyKH Developer Documentation
LuyKH (luykh.com) provides developer-friendly APIs and hosted checkout pages to accept Bakong KHQR payments seamlessly.
Payments settle directly into your own Cambodian bank account (ABA, ACLEDA, Sathapana, etc.) without intermediate fund holding.
Instant Settlement
Funds go straight to your Bakong account via the National Bank of Cambodia network.
Realtime Webhooks
Receive secure HMAC-SHA256 signed event notifications the moment a scan is paid.
Free KHQR SVG Renderer
Render raw KHQR strings dynamically as scalable SVGs without needing API credentials.
Authentication
Authenticate API requests using HTTP Bearer Token authentication in the Authorization header.
ck_test_7a1b92c813094d21e850 (Safe for local tests & sandbox simulation).
Quickstart (5-Minute Integration)
Create your first payment with a simple cURL request:
curl -X POST https://luykh.com/v1/payments \
-H "Authorization: Bearer ck_test_7a1b92c813094d21e850" \
-H "Content-Type: application/json" \
-d '{
"amount": 1.50,
"currency": "USD",
"reference_id": "order_1024",
"description": "Coffee Order #1024"
}'
/v1/payments
Creates a dynamic Bakong KHQR payment session and returns a checkout link, raw KHQR string, and SVG image URL.
Request Parameters (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
| amount | number | Yes | Amount to pay (e.g. 1.50 for USD, 6000 for KHR). |
| currency | string | Optional | Currency: USD (default) or KHR. |
| reference_id | string | Optional | Your internal invoice, order ID or customer reference. |
| description | string | Optional | Item details displayed on the checkout page. |
| callback_url | string | Optional | Customer redirect URL after successful payment. |
| webhook_url | string | Optional | Override webhook endpoint to notify for this specific payment. |
Response Example (201 Created)
{
"type": "payment.created",
"data": {
"payment": {
"id": "pay_c7a31b4029de",
"status": "pending",
"amount": 1.5,
"currency": "USD",
"reference_id": "order_1024",
"description": "Coffee Order #1024",
"qr_string": "00020101021229230015cutluy_demo@aba52045999530384054041.505802KH5915CutLuy Merchant6010Phnom Penh62140110order_102463041A9F",
"checkout_url": "https://luykh.com/pay/pay_c7a31b4029de",
"qr_image_url": "https://luykh.com/api/render/khqr/000201010212...svg",
"created_at": "2026-11-11T01:45:00Z",
"expires_at": "2026-11-11T02:00:00Z"
}
}
}
/v1/payments
Lists all payments for your merchant account, ordered by creation date (newest first).
/api/render/khqr/:khqr.svg
A high-performance utility that validates a raw KHQR payload string and directly renders it as a self-contained SVG image with an immutable cache policy.
Webhooks & Security
CutLuy sends an HTTP POST notification to your configured webhook endpoint whenever a payment succeeds (payment.completed) or expires.
Headers Sent with Every Webhook:
- Content-Type: application/json
- X-CutLuy-Signature: 3a5f98... (HMAC-SHA256 signature)
- X-CutLuy-Timestamp: 1731308400
Verifying Signatures (Node.js & Python)
const crypto = require('crypto');
function verifyWebhook(secret, payload, signature) {
const hash = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(hash),
Buffer.from(signature)
);
}
import hmac, hashlib
def verify_webhook(secret, payload_bytes, sig):
computed = hmac.new(
secret.encode(),
payload_bytes,
hashlib.sha256
).hexdigest()
return hmac.compare_digest(computed, sig)
Try the API Right Now
Generate a real dynamic Bakong KHQR, test the checkout, and simulate payments directly.