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. Install the SDK2 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. Install the SDK

TypeScript / JavaScript (Node 20.3+, Bun or Deno):

Shell
npm install @nicepay/sdk-ts

PHP 8.1+ with ext-curl, ext-json and ext-sodium:

Shell
composer require nicepay/sdk-php

No SDK for your language? Every request is plain HTTPS and JSON; see signing by hand.

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.
//   NICEPAY_KEY_ID=np_test_kid_… NICEPAY_KEY_SECRET=np_test_sk_… bun quickstart.ts
import { NicePay } from "@nicepay/sdk-ts";

const nicepay = new NicePay({
  keyId: process.env["NICEPAY_KEY_ID"] ?? "",
  secret: process.env["NICEPAY_KEY_SECRET"] ?? "",
  // Leave unset: the SDK talks to https://api.mynicepanel.com (test and live alike).
  ...(process.env["NICEPAY_API_BASE"] ? { baseUrl: process.env["NICEPAY_API_BASE"] } : {}),
});

// 1. Check the key works. A test key answers livemode: false.
const ping = await nicepay.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.createPayin(
  {
    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.simulatePayin(payin.id, { 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.getPayin(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.