Nice Paydocs API version 2026-12-01 OpenAPI

Quick start

From nothing to a succeeded test pay-in, from your own code. Budget: 30 minutes, most of it reading; the code runs in seconds.

StepTime
1. Get a test key5 min
2. Copy the signing helper2 min
3. Run your first pay-in5 min
4. Read what happened5 min
5. Plan your webhook endpoint10 min

1. Get a test key

In the merchant portal open Developers → API keys, switch to Test, and create a key with the scopes payins:write and payins:read. You get:

Test mode is fully simulated: no bank, provider or blockchain is involved and no real money moves, but fees, balances, events and webhooks are the real thing.

2. Copy the signing helper

The API is plain HTTPS and JSON, and there is nothing to install. Every request carries a signature, so the examples on this site use one small file that makes it. Save it next to your code:

LanguageSave asNeeds
TypeScript / JavaScriptnicepay.tsBun, or Node 22.18+ — nothing else
PHPnicepay.phpPHP 8.1+ with ext-curl and ext-json

The file is about 150 lines that you can read in full on Authentication and signing. Any other language works the same way with HTTPS, SHA-256 and HMAC-SHA256: follow that page and check your code against the test vectors.

3. Run your first pay-in

Set your key in the environment and run the program below.

Shell
export NICEPAY_KEY_ID=np_test_kid_...
export NICEPAY_KEY_SECRET=np_test_sk_...
runs in CI samples/ts/quickstart.ts samples/php/quickstart.php
// Quick start: your first test pay-in. Needs nicepay.ts (the signing helper) beside it.
//   NICEPAY_KEY_ID=np_test_kid_… NICEPAY_KEY_SECRET=np_test_sk_… bun quickstart.ts
import { nicepay } from "./nicepay.ts";

interface Payin {
  readonly id: string;
  readonly status: string;
  readonly checkout_url: string | null;
  readonly amount_received: string;
  readonly currency: string;
  readonly fee: string | null;
  readonly net_amount: string | null;
}

// 1. Check the key works. A test key answers livemode: false.
const ping = await nicepay<{ project: string; livemode: boolean }>("GET", "/v1/ping");
console.log(`connected: project ${ping.project}, livemode ${String(ping.livemode)}`);

// 2. Create a pay-in. Your own order id is both merchant_order_id and the idempotency
//    key, so sending this again can never create a second pay-in.
const orderId = `DEP-${String(Date.now())}`;
const payin = await nicepay<Payin>("POST", "/v1/payins", {
  body: {
    merchant_order_id: orderId,
    amount: "500.00", // money is always a decimal string
    currency: "INR",
    method: "upi",
    customer: { ref: "player-7591035" },
  },
  idempotencyKey: orderId,
});
console.log(`created ${payin.id}: ${payin.status}, send the customer to ${String(payin.checkout_url)}`);

// 3. Test mode only: pretend the customer paid.
await nicepay("POST", `/v1/test/payins/${payin.id}/simulate`, { body: { action: "succeed" } });

// 4. Wait for it to succeed. (In production your webhook endpoint hears about it.)
for (let i = 0; i < 30; i += 1) {
  const now = await nicepay<Payin>("GET", `/v1/payins/${payin.id}`);
  if (now.status === "succeeded") {
    console.log(`succeeded: received ${now.amount_received} ${now.currency}, fee ${String(now.fee)}, net ${String(now.net_amount)}`);
    process.exit(0);
  }
  await new Promise((resolve) => setTimeout(resolve, 1000));
}
throw new Error("the pay-in did not succeed within 30 seconds");

You should see something like:

Text
connected: project prj_01JD…, livemode false
created pi_01JD…: pending, send the customer to https://pay.mynicepanel.com/c/…
succeeded: received 500.00 INR, fee 10.00, net 490.00

4. Read what happened

5. Next: hear about payments with webhooks

Polling was fine for a first run. In production you learn that a pay-in succeeded from a webhook and you credit your customer once, after fetching the pay-in again. Read Webhooks next — it is the page that keeps you from losing money — then Test mode to try failures, late payments and payouts.