> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sayabelipay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DuitNow QR Generation

> Show the DuitNow QR code inside your own checkout

> [!WARNING]
>
> **Live accounts only.** The QR is only available once Live Mode has been enabled on your account by SayaBeliPay. It doesn't work in sandbox (test) mode: test payments can't produce a real, scannable DuitNow QR. Use sandbox to test the rest of your integration, and contact SayaBeliPay when you're ready to go live.

Instead of redirecting your customer to a checkout page, you can ask SayaBeliPay for the DuitNow QR itself and show it on your own page. The customer scans it with their banking app or e-wallet without ever leaving your site.

## How it works

1. The customer reviews their order on your confirmation page (items, total) and taps **Pay with DuitNow QR**.
2. Only then does your server create a payment with `channel=DUITNOW_QR` and `qr=1`, which asks for the QR instead of a checkout URL.
3. SayaBeliPay returns the **QR** and its **expiry time**.
4. You show the QR on your page, either the standard design or a custom design set up with SayaBeliPay (see below).
5. The customer scans and pays in their app.
6. You confirm the result by [polling the transaction status](https://docs.sayabelipay.com/guides/payment-status.md), the same as for any other payment.

> [!TIP]
>
> Create the QR only when the customer confirms, not when they open the cart or the checkout page. The QR's 5 minutes start the moment it's created, so making it early wastes the customer's time and leaves unused payments behind.

## Request

Use [Create a Payment](https://docs.sayabelipay.com/api-reference/create-payment.md) with all the usual fields, plus `qr=1`. The `channel` must be `DUITNOW_QR`.

| Field | Type | Required | Notes |
| - | - | - | - |
| `channel` | string | Yes | Must be `DUITNOW_QR`. |
| `qr` | string | Yes, for this flow | `1` returns the QR instead of a checkout URL. Leave it out to get the normal checkout URL. |

```bash theme={null}
curl -X POST https://sayabelipay.com/api/payment \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -d amount=25.00 \
  -d quantity=1 \
  -d order_no=ACME-1235 \
  -d order_detail="Order 1235" \
  -d customer_name="Jane Tan" \
  -d customer_email=jane@example.com \
  -d customer_phone=60123456789 \
  -d channel=DUITNOW_QR \
  -d qr=1 \
  -d hash=YOUR_HASH
```

## Response

```json theme={null}
{
  "status": 200,
  "transaction_id": "5C83304DDD99E",
  "qr": {
    "string": "00020201021226...6304ABCD",
    "image_url": "https://...",
    "expires_at": "2026-11-09T15:05:00+08:00",
    "expires_in": 300
  }
}
```

| Field | Notes |
| - | - |
| `transaction_id` | Use this to [check the payment status](https://docs.sayabelipay.com/guides/payment-status.md), the same as any other payment. |
| `qr.string` | The DuitNow QR content. Turn it into a QR code with any QR library. Use it exactly as given. |
| `qr.image_url` | A ready-made QR image you can show instead. It may be missing (`null`); if so, draw the QR from `qr.string`. |
| `qr.expires_at` | When the QR stops working (ISO 8601). |
| `qr.expires_in` | Seconds left until it expires. Use this for your countdown. |

### Errors

These come back with HTTP `200` and the error code in the `status` field.

| `status` | Meaning | What to do |
| - | - | - |
| `400` | The QR option is only for `DUITNOW_QR` payments on accounts with Live Mode enabled. | Check the channel, and that your account is live. |
| `502` | The payment was created, but the QR could not be generated. | Create a **new payment with a new `order_no`**. The unused payment expires on its own. |

```json theme={null}
{ "status": 502, "message": "Could not generate the DuitNow QR. Please try again.", "transaction_id": "5C83304DDD99E" }
```

## Rules for the QR

| Rule | What it means for you |
| - | - |
| **Valid for 5 minutes** | Show a countdown. When it runs out, hide the QR and offer a "Try again" button. |
| **One payment only** | Each QR can be paid once. To retry after it expires, create a **new payment with a new `order_no`**. |
| **Amount is fixed** | The amount is built into the QR. The customer can't change it in their app. |
| **Don't alter the QR** | The QR is digitally signed. Editing or redrawing it makes banking apps reject it. For a branded look, request a [custom design](#custom-qr-design). |

## Custom QR design

The standard QR works for every account. If you'd like the QR to match your brand, **contact SayaBeliPay to request a custom design**, and we'll set it up and test it with you. Please send us:

* your business name as it should appear on the page
* your logo (PNG or SVG)
* your brand colour

**What can be customised:**

* your business name, logo and colours around the QR
* the colour of the QR code itself, as long as it stays **dark on a light background** (so every banking app can read it)
* a small logo in the centre of the QR

**What can't be changed:** the name the customer's app shows after scanning. Banking apps read that name from inside the QR, which is digitally signed, so they will always show **CHIP IN SDN. BHD.**, our payment processor, not your business name.

> [!WARNING]
>
> Customers who see your name on the page but a different name in their banking app may think something is wrong and stop paying. Always add a line under the QR such as:
>
> *"Payment processed securely by CHIP IN SDN. BHD."*

## What to show the customer

A clear QR page usually has:

* your business name and logo
* the amount, e.g. **RM 25.00**
* the QR code
* a countdown, e.g. "Expires in 04:32"
* a short instruction, e.g. "Scan with any banking or e-wallet app that supports DuitNow QR"
* the line "Payment processed securely by CHIP IN SDN. BHD."
* a "QR expired, try again" state for when the countdown ends


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.