Quick start
Take your first MMQR payment in test mode in about ten minutes.
Klink Pay is a REST API at https://sandbox-api.klinkpay.net/v1. You create a payment from your server, show the customer a QR code (or send them to our hosted checkout), and we tell your server when it is paid with a signed webhook. Every amount is an integer in the currency's smallest unit; MMK has no decimals, so 15200 is 15,200 Ks.
1. Get a test key
- Sign up and set up two-factor sign-in.
- Open Developers → API keys in the dashboard and create a test secret key. It starts with
kp_test_and is shown once: store it as a secret on your server (e.g.KLINK_PAY_SECRET_KEY).
kp_live_) can be created once your account has been reviewed and is active. See Authentication.2. Create a payment
Call POST /v1/payments from your server with the amount and your own order reference. Send an Idempotency-Key so a retry never creates a second payment.
curl https://sandbox-api.klinkpay.net/v1/payments \
-H "Authorization: Bearer kp_test_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1001" \
-d '{
"amount": 15200,
"currency": "MMK",
"reference": "order-1001",
"description": "Table 4",
"return_url": "https://shop.example.com/orders/1001"
}'The response is a payment in status pending:
{
"id": "pay_4Nq7xY2mKc8vTz1aB3dE9f",
"object": "payment",
"livemode": false,
"status": "pending",
"amount": 15200,
"currency": "MMK",
"method": "mmqr",
"reference": "order-1001",
"bank_reference": "KP7GQ2M9XW4T",
"description": "Table 4",
"checkout_url": "https://checkout.klinkpay.net/c/pay_4Nq7xY2mKc8vTz1aB3dE9f",
"qr_payload": "00020101021226…6304A1B2",
"redirect_url": null,
"customer_phone": null,
"return_url": "https://shop.example.com/orders/1001",
"metadata": {
"order_id": "1001"
},
"failure_reason": null,
"expires_at": "2026-11-27T10:15:00Z",
"succeeded_at": null,
"created_at": "2026-11-27T10:00:00Z",
"amount_refunded": 0,
"fees": null,
"net": null,
"payment_link": null
}3. Let the customer pay
Pick one of two ways:
- Redirect to the hosted checkout. Send the customer to
checkout_url. It shows the amount, the QR, a countdown and the live status, and returns them to yourreturn_urlafter a successful payment (withpayment_idandstatusadded to the query string). - Show the QR yourself. Draw
qr_payloadas a QR code (any QR library) in your app or on a screen at the counter. The customer scans it with KBZPay, WavePay, AYA Pay, CB Pay or any MMQR banking app.
import QRCode from "qrcode";
const svg = await QRCode.toString(payment.qr_payload, { type: "svg", margin: 1 });
// Put the SVG on your page; show payment.amount and a timer until payment.expires_at.To push a payment request into the customer's AYA Pay app instead of showing a QR, create the payment with "method": "ayapay_push" and their customer_phone.
4. Handle the webhook
Add an endpoint under Developers → Webhooks in the dashboard (or with the API) and keep its signing secret. When the payment succeeds we POST a payment.succeeded event to it. Verify the Klink-Signature header, then fulfil the order. Answer with a 2xx quickly; anything else is retried.
import crypto from "node:crypto";
import express from "express";
const app = express();
const SECRET = process.env.KLINK_PAY_WEBHOOK_SECRET;
const TOLERANCE_SECONDS = 300;
// Use the raw body: the signature covers the exact bytes we sent.
app.post("/webhooks/klink-pay", express.raw({ type: "application/json" }), (req, res) => {
const header = req.get("Klink-Signature") ?? "";
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
const t = Number(parts.t);
const body = req.body.toString("utf8");
const expected = crypto.createHmac("sha256", SECRET).update(`${t}.${body}`).digest("hex");
const given = Buffer.from(parts.v1 ?? "", "hex");
const valid =
given.length === expected.length / 2 &&
crypto.timingSafeEqual(given, Buffer.from(expected, "hex")) &&
Math.abs(Date.now() / 1000 - t) <= TOLERANCE_SECONDS;
if (!valid) return res.status(400).send("bad signature");
const event = JSON.parse(body);
// Deduplicate by event.id, then hand off to a queue and answer quickly.
if (event.type === "payment.succeeded") {
markOrderPaid(event.data.object.reference);
}
res.sendStatus(200);
});Trust the webhook, not the redirect
return_url, and anyone can open that URL. Mark an order paid only from a verified webhook, or by fetching the payment with GET /v1/payments/:id.5. Test it
Open the checkout_url of a test payment. Test mode has Simulate payment and Simulate failure buttons instead of a real bank; your webhook receives the event as it would in live mode. See Test mode.
6. Go live
- In the dashboard, complete the onboarding checklist: business profile, documents, bank account, then Submit for review.
- Once your account is
active, create a live key and a live (or both-modes) webhook endpoint. - Swap
kp_test_forkp_live_on your server. Successful payments are paid out to your bank account the next business day (T+1).