For the complete documentation index, see llms.txt. This page is also available as Markdown.

Generate DuitNow QR


v3 POST api.console.bayar.cash/v3/payment-intents/{payment_intent_id}/duitnow-qr


Generate a DuitNow QR for an existing payment intent so you can render it on your own page or POS — no redirect to the Bayarcash checkout page. The response contains the raw QR payload (qr_string) and a ready-to-display PNG (qr_image), plus a polling URL to track the payment status.

The payment intent must have been created with a single DuitNow QR payment channel (codes 6, 7, 8, 9, 10, 11, 13, 14, 15 — refer to the Payment Channel page) and still be payable.

Tip: For the common case you can skip this endpoint entirely — pass generate_qr: true when creating the payment intent and the same duitnow_qr object is returned inline. See the One-Step DuitNow QR section on the Payment Intent page. This endpoint remains useful for generating a fresh QR after a previous one expired.

Example of sending POST request with cURL. No request body is required.

curl -X POST https://api.console.bayar.cash/v3/payment-intents/pi_MGWpzp/duitnow-qr \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <Personal_Access_Token>'

Example of JSON structured response.

{
    "type": "duitnow_qr",
    "transaction_id": "trx_z88ymJ",
    "payment_intent_id": "pi_MGWpzp",
    "qr_string": "00020201021226580014A000000615000101065...",
    "qr_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
    "qr_expires_at": "2026-08-20T14:05:12+08:00",
    "poll_url": "https://api.console.bayar.cash/v3/transactions/trx_z88ymJ/duitnow-qr/status",
    "next_poll_after_ms": 2000,
    "amount": 21.10,
    "currency": "MYR",
    "order_number": "1351"
}
Field
Description

qr_string

Raw DuitNow QR payload — encode it into a QR image yourself if you prefer

qr_image

Ready-to-display PNG data URI — render it directly in an <img> tag. May be null if image rendering failed; fall back to qr_string

qr_expires_at

ISO 8601 datetime. The QR is valid for about 5 minutes — show a countdown and offer a new QR after expiry

poll_url

Status polling endpoint for this QR's transaction

next_poll_after_ms

Minimum delay between polls, in milliseconds


Response Codes

Code
Meaning

201

A fresh QR was generated

200

An active (unexpired, unpaid) QR already exists for this payment intent — the same QR is returned, nothing is regenerated. Safe to call repeatedly

403

{"success": false, "message": "..."} — the payment intent is not a DuitNow QR intent, is no longer payable (completed/expired/cancelled), or your account cannot accept DuitNow QR payments. The message explains why. Retrying will not help

409

Another request is generating a QR for this payment intent right now — retry after a short delay

502

Temporary upstream failure — retry the request

Important: After the QR expires unpaid, calling this endpoint again generates a fresh QR for the same payment intent — as long as the payment intent itself has not expired (link_expired_at).

Last updated