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

# DuitNow Pay

> Steps to integrate S2S JSON API and accept payments using DuitNow Pay.

Available in
🇲🇾 Malaysia

[DuitNow Pay](https://razorpay.com/docs/my/payments/payment-methods/duitnow/pay.md) lets your customers pay from their Malaysian bank account. With the S2S integration, your server creates the payment with the customer's bank, and you redirect the customer to the URL Razorpay Curlec returns. The customer approves the payment on their bank's page and comes back to your callback URL.

## Prerequisites

* S2S integration and DuitNow Pay are enabled on your account. Razorpay Curlec does not enable S2S by default. DuitNow Pay is in early access, and your business must be registered with PayNet; Razorpay Curlec does this for you. Contact your account manager to enable both.
* You have live [API keys](https://razorpay.com/docs/my/payments/dashboard/account-settings/api-keys.md#generate-api-keys). DuitNow Pay is not available in test mode. Test with a live RM 1.00 payment.
* You have [set up webhooks](https://razorpay.com/docs/my/webhooks/setup-edit-payments.md) for `payment.captured` and `payment.failed` (recommended).

## Integration Steps

Follow the steps below to integrate the Razorpay Curlec S2S JSON API and accept payments using DuitNow Pay.

**1.1** [Get the List of Banks](#1-1-get-the-list-of-banks)

**1.2** [Create an Order](#1-2-create-an-order)

**1.3** [Create a Payment](#1-3-create-a-payment)

**1.4** [Redirect the Customer to Their Bank](#1-4-redirect-the-customer-to-their-bank)

**1.5** [Handle the Callback](#1-5-handle-the-callback)

**1.6** [Fetch Payment Details and Verify Payment Status](#1-6-fetch-payment-details-and-verify-payment-status)

### 1.1 Get the List of Banks

Your customer must pick their bank on your page before you create the payment. Pass the bank's code in the `bank` field.

Banks active for DuitNow Pay at Razorpay Curlec:

| Code | Bank |
| - | - |
| `PHBM` | Affin Bank |
| `AGOB` | Agro Bank |
| `MFBB` | Alliance Bank Malaysia Berhad |
| `ARBK` | AmBank Berhad |
| `BIMB` | Bank Islam |
| `BKRM` | Bank Kerjasama Rakyat Malaysia Berhad |
| `BMMB` | Bank Muamalat |
| `BSNA` | Bank Simpanan Nasional Berhad |
| `CIMY` | CIMB Bank |
| `HLBB` | Hong Leong Bank Berhad |
| `HSBC` | HSBC Bank |
| `KFHO` | Kuwait Finance House |
| `MB2U` | Maybank |
| `AFBQ` | MBSB Bank Berhad |
| `OCBC` | OCBC Bank (Malaysia) Berhad |
| `PBBE` | Public Bank Berhad |
| `RHBB` | RHB Banking Group |
| `SCBL` | Standard Chartered Bank Malaysia Berhad |

> [!NOTE]
>
> **Handy Tips**
>
> * The list of banks may change. Unlike FPX, the [Methods API](https://razorpay.com/docs/my/payments/payment-gateway/s2s-integration/json/v2/build-integration/fpx.md#1-1-generate-the-list-of-banks-supporting-fpx) does not return DuitNow Pay banks yet.
> * Some of these codes are also FPX bank codes. For DuitNow Pay, always send them with the method `duitnow`.

### 1.2 Create an Order

To process a payment, create a Razorpay Curlec Order to correspond with the order in your system. Create an order in MYR for every payment. The amount is in sen: minimum `100` (RM 1.00), maximum `5000000` (RM 50,000).

**Order is an important step in the payment process.**

* An order should be created for every payment.
* You can create an order using the [Orders API](#api-sample-code). It is a server-side API call. Know how to [authenticate](https://razorpay.com/docs/my/payments/dashboard/account-settings/api-keys.md#generate-api-keys) Orders API.
* The `order_id` received in the response should be passed in the payment request. This ties the order with the payment and secures the request from being tampered.

> [!WARNING]
>
> **Watch Out!**
>
> Payments made without an `order_id` cannot be captured and will be automatically refunded. You must create an order before initiating payments to ensure proper payment processing.

#### API Sample Code

Use this endpoint to create an order using the Orders API.

`POST /orders`

```bash Curl theme={null}
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/orders \
-H "content-type: application/json" \
-d '{
  "amount": 10000,
  "currency": "MYR",
  "receipt": "receipt#1",
  "notes": {
    "notes_key_1": "Nasi Lemak"
  }
}'
```

```java Java theme={null}
RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

JSONObject orderRequest = new JSONObject();
orderRequest.put("amount", 10000); // amount in sen
orderRequest.put("currency", "MYR");
orderRequest.put("receipt", "receipt#1");

Order order = razorpay.orders.create(orderRequest);
```

```python Python theme={null}
import razorpay
client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

DATA = {
    "amount": 10000,
    "currency": "MYR",
    "receipt": "receipt#1",
    "notes": {
        "notes_key_1": "Nasi Lemak"
    }
}
client.order.create(data=DATA)
```

```php PHP theme={null}
$api = new Api($key_id, $secret);

$api->order->create(array('receipt' => 'receipt#1', 'amount' => 10000, 'currency' => 'MYR', 'notes' => array('notes_key_1' => 'Nasi Lemak')));
```

```csharp .NET theme={null}
RazorpayClient client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

Dictionary<string, object> options = new Dictionary<string, object>();
options.Add("amount", 10000); // amount in sen
options.Add("receipt", "receipt#1");
options.Add("currency", "MYR");
Order order = client.Order.Create(options);
```

```ruby Ruby theme={null}
require "razorpay"
Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')

order = Razorpay::Order.create(amount: 10000, currency: 'MYR', receipt: 'receipt#1')
```

```javascript Node.js theme={null}
var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

instance.orders.create({
  amount: 10000,
  currency: "MYR",
  receipt: "receipt#1",
  notes: {
    notes_key_1: "Nasi Lemak"
  }
})
```

```go Go theme={null}
import ( razorpay "github.com/razorpay/razorpay-go" )
client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

data := map[string]interface{}{
  "amount": 10000,
  "currency": "MYR",
  "receipt": "receipt#1",
}
body, err := client.Order.Create(data, nil)
```

```json Success Response theme={null}
{
  "id": "order_TrGnI0fFdayPhx",
  "entity": "order",
  "amount": 10000,
  "amount_paid": 0,
  "amount_due": 10000,
  "currency": "MYR",
  "receipt": "receipt#1",
  "offer_id": null,
  "status": "created",
  "attempts": 0,
  "notes": {
    "notes_key_1": "Nasi Lemak"
  },
  "created_at": 1792741090
}
```

> [accordion] Request Parameters
>
> `amount` *mandatory*
> : `integer` Payment amount in sen. For example, for RM 100.00, enter `10000`. Minimum `100` (RM 1.00), maximum `5000000` (RM 50,000).
>
> `currency` *mandatory*
> : `string` Must be `MYR`.
>
> `receipt` *optional*
> : `string` Your receipt id for this order. Maximum length is 40 characters.
>
> `notes` *optional*
> : `json object` Key-value pairs to store additional information about the order. Maximum 15 key-value pairs, 256 characters (maximum) each.
>
> Know more about [Orders API](https://razorpay.com/docs/my/api/orders/create.md).

> [accordion] Response Parameters
>
> Descriptions for the response parameters are present in the [Orders Entity](https://razorpay.com/docs/my/api/orders/entity.md) parameters table.

### 1.3 Create a Payment

Once an order is created, create a payment with `duitnow` as the method, `duitnow.flow` as `online_banking` and the customer's bank code.

`POST /payments/create/json`

```bash Request theme={null}
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/payments/create/json \
-H "content-type: application/json" \
-d '{
  "amount": 10000,
  "currency": "MYR",
  "order_id": "order_TrGnI0fFdayPhx",
  "email": "nur.aisyah@example.com",
  "contact": "+60123456789",
  "method": "duitnow",
  "duitnow": {
    "flow": "online_banking"
  },
  "bank": "HSBC",
  "callback_url": "https://merchant.example.my/payment/return"
}'
```

```json Response theme={null}
{
  "razorpay_payment_id": "pay_TrGnjadtYa5w0A",
  "next": [
    {
      "action": "redirect",
      "url": "https://api.razorpay.com/pg_router/v1/payments/TrGnjadtYa5w0A/authenticate"
    }
  ]
}
```

#### Request Parameters

`amount` *mandatory*
: `integer` Amount in sen. Must match the order amount. Minimum `100` (RM 1.00), maximum `5000000` (RM 50,000).

`currency` *mandatory*
: `string` Must be `MYR`.

`order_id` *mandatory*
: `string` The order ID from [step 1.2](#1-2-create-an-order).

`email` *mandatory*
: `string` Customer's email address.

`contact` *mandatory*
: `string` Customer's phone number with country code. For example, `+60123456789`.

`method` *mandatory*
: `string` Must be `duitnow`.

`duitnow` *mandatory*
: `object` DuitNow details.

`flow` *mandatory*
: `string` Must be `online_banking`.

`bank` *mandatory*
: `string` Code of the customer's bank, from [step 1.1](#1-1-get-the-list-of-banks).

`callback_url` *mandatory*
: `string` Where Razorpay Curlec sends the customer, and the payment result, after the bank.

`notes` *optional*
: `object` Key-value pairs to store additional information. Maximum 15 key-value pairs.

#### Response Parameters

`razorpay_payment_id`
: `string` Unique identifier of the payment. Store it to track the payment.

`next`
: `array` One action object.

`action`
: `string` Always `redirect` for DuitNow Pay.

`url`
: `string` Send the customer's browser to this URL. It opens the page of the bank in the request.

#### Request Errors

These requests are rejected:

| When | What to do |
| - | - |
| DuitNow Pay is not enabled on your account | Ask your account manager to enable DuitNow Pay. |
| `duitnow.flow` is missing or not `online_banking` | Send `duitnow.flow` as `online_banking`. |
| `bank` is missing or not a valid code | Send a bank code from [step 1.1](#1-1-get-the-list-of-banks). |
| Currency is not MYR, or does not match the order | Create the order and payment in MYR. |
| Amount is below RM 1.00 or above RM 50,000 | Use an amount within the limits. |

### 1.4 Redirect the Customer to Their Bank

Redirect the customer's browser to `next[].url` straight away. The customer logs in to their bank and approves the payment.

> [!WARNING]
>
> **Watch Out!**
>
> Do not open the URL in a hidden frame or an iframe. Some banks block this.

### 1.5 Handle the Callback

After the bank, Razorpay Curlec sends the customer back to your `callback_url` with a form-encoded `POST` request.

#### Success Callback

If the payment is successful, the following fields are sent:

* `razorpay_payment_id`
* `razorpay_order_id`
* `razorpay_signature`

```text Callback Example theme={null}
razorpay_order_id=order_TrGnI0fFdayPhx
&razorpay_payment_id=pay_TrGnjadtYa5w0A
&razorpay_signature=33be902599c95a2aeeb0fa99621e94419b0989143abb2c41486b988884be4c66
```

Verify the signature with your key secret, as for any other payment.

#### Failure Callback

If the payment fails, the callback contains error fields and no signature. Refer to [Errors](https://razorpay.com/docs/my/errors) for details.

> [!WARNING]
>
> **Watch Out!**
>
> Never fulfil an order from the callback alone. Confirm the payment with a webhook or by fetching the payment, as explained in [step 1.6](#1-6-fetch-payment-details-and-verify-payment-status).

### 1.6 Fetch Payment Details and Verify Payment Status

Subscribe to the `payment.captured` and `payment.failed` webhooks. You also receive `payment.authorized` and `order.paid`. Each carries the method `duitnow`, `duitnow.flow` as `online_banking` and the `bank` code. [Validate the `X-Razorpay-Signature` header](https://razorpay.com/docs/my/webhooks/validate-test#validate-webhooks) on each webhook. The same event can be delivered more than once, so fulfil each order only once, for example by checking the payment ID before you fulfil.

Then fetch the payment with your API keys before you fulfil the order:

```bash Request theme={null}
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X GET https://api.razorpay.com/v1/payments/pay_TrGnjadtYa5w0A
```

```json Response theme={null}
{
  "id": "pay_TrGnjadtYa5w0A",
  "entity": "payment",
  "amount": 10000,
  "currency": "MYR",
  "base_amount": 10000,
  "status": "captured",
  "order_id": "order_TrGnI0fFdayPhx",
  "invoice_id": null,
  "international": false,
  "method": "duitnow",
  "duitnow": {
    "flow": "online_banking"
  },
  "bank": "HSBC",
  "amount_refunded": 0,
  "refund_status": null,
  "captured": true,
  "description": null,
  "card_id": null,
  "wallet": null,
  "vpa": null,
  "email": "nur.aisyah@example.com",
  "contact": "+60123456789",
  "notes": [],
  "fee": 0,
  "tax": 0,
  "error_code": null,
  "error_description": null,
  "error_source": null,
  "error_step": null,
  "error_reason": null,
  "acquirer_data": {},
  "created_at": 1792741106
}
```

Fulfil the order only when `status` is `captured` and the `amount` and `order_id` match.

> [!NOTE]
>
> **Handy Tips**
>
> On the Razorpay Curlec Dashboard, ensure that the payment status is `captured`. Refer to the payment capture settings page to know how to [capture payments automatically](https://razorpay.com/docs/my/payments/payments/capture-settings.md).

## Refunds

You can refund a DuitNow Pay payment in full or in part, the same as any other payment, using the [Refunds API](https://razorpay.com/docs/my/api/refunds/create-normal.md) (`POST /v1/payments/{id}/refund`). During early access, Razorpay Curlec pays the customer by bank transfer within 5 to 7 working days, and the refund then shows as processed. Do not also refund the customer yourself.

## Frequently Asked Questions (FAQs)

> [accordion] 1. Can I get the bank list from an API?
>
> Not yet. Use the bank codes in [step 1.1](#1-1-get-the-list-of-banks).

> [accordion] 2. Is the callback\_url required?
>
> Yes. Razorpay Curlec sends the customer and the payment result to it after the bank.

> [accordion] 3. Can I test in test mode?
>
> No. Make a live RM 1.00 payment.

> [accordion] 4. Do I need PCI-DSS certification?
>
> No. DuitNow Pay does not involve card data.

## Next Steps

DuitNow Pay is not available in test mode, so skip Step 2: Test Integration for this method. Make a live RM 1.00 payment, then complete the [Go-live Checklist](https://razorpay.com/docs/my/payments/payment-gateway/s2s-integration/json/v2/go-live-checklist.md).

### Related Information

* [DuitNow Pay](https://razorpay.com/docs/my/payments/payment-methods/duitnow/pay.md)
* [S2S Payment Methods](https://razorpay.com/docs/my/payments/payment-gateway/s2s-integration/payment-methods.md)
* [Refunds](https://razorpay.com/docs/my/payments/refunds/normal.md)
