REST API · OpenAPI 3.0

BakongPay
API Reference

Generate Bakong KHQR payment codes, verify transactions, and build payment flows — all through a single REST API.

Bearer Auth

API key based

5 endpoints

REST / JSON

5 SDKs

JS, Python, PHP…

Rate limited

Per plan

Base URLhttps://khpay.angkorhub.site
POST/api/v1/khqr/create

Creates a Bakong-compliant KHQR QR code with a signed transaction ID, MD5 hash, and Base64 PNG image ready for display.

Request Body

amountnumberrequired

Payment amount · e.g. 25

currencyenum
USDKHR

USD or KHR · default: USD

merchantNamestringrequired

Merchant display name (max 25 chars) · e.g. FINN SHOP

bakongIdstringrequired

Bakong account ID · e.g. merchant@acleda

descriptionstring

Order reference (max 100 chars) · e.g. Order #1234

expiresInSecondsinteger

QR expiry time in seconds · default: 900

Responses

200KHQR generated
{
  "success": true,
  "data": {
    "transactionId": "uuid-...",
    "qrString": "000201...",
    "qrImage": "data:image/png;base64,...",
    "md5": "a1b2c3d4...",
    "deepLink": "bakong://pay?qr=...",
    "checkoutUrl": "https://app.../pay/uuid",
    "expiresAt": "2026-06-02T14:00:00Z"
  }
}
401Missing or invalid API key
422Validation failed
429Rate limit exceeded
curl -X POST https://khpay.angkorhub.site/api/v1/khqr/create \
  -H "Authorization: Bearer bk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 25.00,
    "currency": "USD",
    "merchantName": "FINN SHOP",
    "bakongId": "merchant@acleda",
    "description": "Order #1234"
  }'
POST/api/v1/check/md5

Polls the Bakong NBC network for the payment status of a given MD5 hash. Use this after generating a KHQR to confirm payment.

Request Body

md5stringrequired

32-char hex MD5 from KHQR creation · e.g. a1b2c3d4e5f67890a1b2c3d4e5f67890

Responses

200Status returned
{
  "success": true,
  "data": {
    "md5": "a1b2...",
    "status": "SUCCESS",
    "transaction": {
      "hash": "0x...",
      "from": "sender@bank",
      "to": "merchant@acleda",
      "amount": 25.00,
      "currency": "USD",
      "timestamp": 1748865600000
    }
  }
}
401Invalid API key
curl -X POST https://khpay.angkorhub.site/api/v1/check/md5 \
  -H "Authorization: Bearer bk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "md5": "a1b2c3d4e5f67890a1b2c3d4e5f67890" }'
POST/api/v1/check/bulk Pro+

Check up to 50 MD5 hashes in a single request. Ideal for reconciliation jobs. Requires Pro or Enterprise plan.

Request Body

md5sstring[]required

Array of MD5 hashes (max 50)

Responses

200Bulk results
{
  "success": true,
  "data": {
    "total": 2,
    "results": {
      "a1b2...": { "status": "SUCCESS" },
      "c3d4...": { "status": "PENDING" }
    }
  }
}
403Plan upgrade required
curl -X POST https://khpay.angkorhub.site/api/v1/check/bulk \
  -H "Authorization: Bearer bk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "md5s": ["a1b2c3...", "d4e5f6..."] }'
POST/api/v1/check/transaction

Look up a stored transaction by its ID, MD5, or blockchain hash.

Request Body

querystringrequired

The value to search for

typeenum
transactionIdmd5hash

Lookup type · default: transactionId

Responses

200Transaction found
404Transaction not found
curl -X POST https://khpay.angkorhub.site/api/v1/check/transaction \
  -H "Authorization: Bearer bk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "query": "uuid-...",
    "type": "transactionId"
  }'
POST/api/v1/qr/generate

Render a custom-styled QR image from any KHQR string. Supports custom colors and sizes in PNG or SVG.

Request Body

qrStringstringrequired

KHQR payload string

sizeinteger

Image size in px (100–2000) · default: 300

foregroundstring

Foreground hex color · default: #000000

backgroundstring

Background hex color · default: #FFFFFF

formatenum
pngsvg

Output format · default: png

Responses

200Image data returned
curl -X POST https://khpay.angkorhub.site/api/v1/qr/generate \
  -H "Authorization: Bearer bk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "qrString": "000201...",
    "size": 400,
    "foreground": "#1a1a2e",
    "background": "#ffffff",
    "format": "png"
  }'