Quickstart
Create a paid test payment in five minutes. You’ll need a PayKH account and a test API key.
1. Get a test API key
Sign in to the dashboard, open a store, go to API keys, and create a key in test mode. Test keys start with bk_test_ and never move real money.
⚠️ Keep your secret safe
The full key is shown only once at creation. Store it in an environment variable — never commit it or expose it in front-end code.
2. Create a payment
Send the amount as a decimal string. The response contains a qr_string (the KHQR payload) you render for the customer.
curl
curl https://api.paykh.cambobia.com/v1/payments \
-H "Authorization: Bearer bk_test_your_key" \
-H "Content-Type: application/json" \
-d '{
"amount": "1.50",
"currency": "USD",
"reference_id": "order_1001",
"description": "Cappuccino"
}'201 Created
{
"id": "pay_JuBodnQ6Pm1DbHYCP3v77YbH",
"status": "pending",
"amount": "1.50",
"currency": "USD",
"reference_id": "order_1001",
"qr_string": "00020101021229...6304AB12",
"expires_at": "2026-07-12T09:30:00.000Z"
}3. Show the KHQR
Render qr_string as a QR code with any QR library, or send the customer to the hosted checkout page which renders it, shows a live status, and handles expiry for you:
Hosted checkout
https://checkout.paykh.cambobia.com/pay/pay_JuBodnQ6Pm1DbHYCP3v77YbH4. Simulate payment (test mode)
In test mode there’s no real bank, so you drive the outcome yourself:
curl
curl https://api.paykh.cambobia.com/v1/payments/pay_JuBodnQ6Pm1DbHYCP3v77YbH/simulate \
-H "Authorization: Bearer bk_test_your_key" \
-H "Content-Type: application/json" \
-d '{ "status": "paid" }'5. Confirm the status
curl
curl https://api.paykh.cambobia.com/v1/payments/pay_JuBodnQ6Pm1DbHYCP3v77YbH \
-H "Authorization: Bearer bk_test_your_key"You’ll see "status": "paid". In production you don’t poll — you receive a webhook the instant the payment completes.
✅ That's the full loop
Create → show QR → get paid → confirm. Everything else (links, refunds, webhooks, settlement) builds on this.