Nice Paydocs API version 2026-12-01 OpenAPI

Pay-ins

A pay-in is one payment from your customer to you. You create it, the customer pays, we tell you.

Create one

POST /v1/payinsReference

Request

FieldNotes
merchant_order_idyour order id: 1 to 64 characters of A–Z a–z 0–9 _ . : -; unique per project forever
amount, currency"10000.00", "INR" (USDT methods take "USDT")
methodupi, bank_transfer, usdt_trc20, usdt_bep20, or auto (we pick: in live mode an INR auto pay-in is UPI, and the pay-in says upi)
customer.refyour customer's id, in the same form as an order id; name, phone, email and ip are optional — but see your customer's mobile and e-mail
return_urloptional https URL where the payment page sends the customer back. Its host must be on your project's allowlist in the portal
expires_inoptional, seconds (60–86,400): how long the customer has to pay; the payment page's clock counts it down
channeloptional, INR only: one channel by its id — upi, qr, instant, qr_lite, qr_2 or bank: that channel's QR or payment page is used for the deposit, and the pay-in never moves to another channel; or desk (a payment desk's QR or account, shown on the payment page) or gateway (any channel's payment page). Leave it out and your routing chooses among all. A channel that is not on your routes: 422 method_not_available; when nothing of that kind can take the payment now: 503 rail_unavailable, as when nothing can
metadataoptional, up to 20 keys with string values (at most 500 characters each); returned on the object and in events
descriptionoptional: why, in your words — e.g. "player deposit" (at most 200 characters); shown on the payment, in exports and in its payment record

Response

201 with the pay-in, in status pending:

Errors

CodeWhen
422 amount_too_smallthe amount is below your smallest pay-in in that currency (live mode; min_amount and max_amount give your range), or the fees would leave you nothing of it (no range given)
409 duplicate_merchant_referencea pay-in with this merchant_order_id exists; existing_id is its id
409 invoice_already_openthis customer already has an open USDT invoice on that chain, still waiting for money
403 limit_exceededthe amount is above your largest pay-in (limit amount_max, with min_amount and max_amount); or this customer has too many open pay-ins, reached the number allowed for the period, or asked again too soon — limit says which (customer_open, customer_unreferenced, customer_daily, customer_hourly, customer_gap), limit_max how many a count allows, and for the gap retry_after_seconds how long until the customer may ask again
422 method_not_availablethe method is not set up for your project, the channel you named is not on your routes, or Nice Pay has switched that currency off for you (live mode): switched_off is fiat (INR) or crypto (USDT)
503 rail_unavailablenothing can take this payment right now; retry later or offer another method
400 invalid_requesta field is wrong; errors names it

Nothing is created when a request is refused. The idempotency errors are on the idempotency page, and every code is on the errors page.

Your customer's mobile and e-mail

Some channels pass the payer's mobile number and e-mail to the bank and refuse a payment without a mobile (today the QR channel and the Bank channel). The portal's Developers and Channels pages list the channels on your routes that need them.

Your limits

In live mode every pay-in is checked against your terms with Nice Pay: whether INR ("fiat") and USDT ("crypto") are on for you, and the smallest and largest single pay-in in each currency. Unless agreed otherwise they are ₹300 to ₹20,000 and 5 to 50,000 USDT, both on; your terms are on the portal's Settings page, and GET/v1/methods applies them. Test mode does not apply them.

Example

runs in CI samples/ts/payins.ts
// Pay-ins: create one per order exactly once, read it back, list, cancel.
//   bun payins.ts DEP-48213
import { nicepay, NicePayError } from "./nicepay.ts";

interface Payin {
  readonly id: string;
  readonly status: string;
  readonly amount: string;
  readonly currency: string;
  readonly rail: string;
}

/**
 * The pay-in for one of your orders: created the first time, the same one every time
 * after — whether you retry a second later (idempotency key) or a week later
 * (merchant_order_id is unique per project forever).
 */
async function payinForOrder(orderId: string, amount: string): Promise<Payin> {
  try {
    return await nicepay<Payin>("POST", "/v1/payins", {
      body: { merchant_order_id: orderId, amount, currency: "INR", method: "upi", customer: { ref: "player-7591035" }, metadata: { cart: "c-1" } },
      idempotencyKey: orderId,
    });
  } catch (error) {
    if (error instanceof NicePayError && error.code === "duplicate_merchant_reference") {
      return nicepay<Payin>("GET", `/v1/payins/${String(error.problem["existing_id"])}`);
    }
    throw error;
  }
}

const orderId = process.argv[2] ?? `DEP-${String(Date.now())}`;
const first = await payinForOrder(orderId, "750.00");
const again = await payinForOrder(orderId, "750.00");
console.log(`order ${orderId} → ${first.id} (again: ${again.id}, same: ${String(first.id === again.id)})`);

// Read it back. checkout_url is only in the create response; store it if you need it.
const fetched = await nicepay<Payin>("GET", `/v1/payins/${first.id}`);
console.log(`status ${fetched.status}, amount ${fetched.amount} ${fetched.currency}, rail ${fetched.rail}`);

// Find it by your own id.
const found = await nicepay<{ data: Payin[] }>("GET", "/v1/payins", { query: { merchant_order_id: orderId } });
console.log(`found by merchant_order_id: ${String(found.data.length)}`);

// The customer gave up: cancel. (If money still arrives, the pay-in succeeds anyway — "late money wins".)
if (fetched.status === "pending") {
  const cancelled = await nicepay<Payin>("POST", `/v1/payins/${first.id}/cancel`);
  console.log(`cancelled: ${cancelled.status}`);
}

Which methods you can offer now

GET /v1/methodsReference

Ask before you show your payment choices. Each method comes with available, your fee and, in live mode, min_amount and max_amount:

Find pay-ins

GET/v1/payins and GET/v1/payouts list yours, newest first, 100 at most per page (limit, starting_after). Filters, all optional and combined:

FilterMatches
customer_refyour customer's reference
referenceexactly one reference: a UTR or bank reference (spaces and case ignored) or a transaction hash
method, status, currencyas on the object
created_from, created_toan ISO 8601 instant with its offset, both inclusive
amount_min, amount_maxan amount in currency (required with them)
legacy_id, importedpayments imported from your previous system, by their old id; imported=true, false or both (the default)

A pay-in carries reference once it is known: the UTR (or bank reference) for INR, the transaction hash of its first transfer for USDT.

Statuses

Text
pending ──► processing ──► succeeded            (final)
   │             ├──► failed  ──┐
   │             └──► expired ──┤
   ├──► succeeded               ├──► succeeded  (money arrived late)
   ├──► failed  ────────────────┤
   ├──► expired ────────────────┤
   └──► cancelled ──────────────┘

pending waitingprocessing in progresssucceeded finished wellfailed went wrongexpired overcancelled over

Cancel

POST/v1/payins/{id}/cancel while it is pending; in any other status the answer is 409 invalid_state. Cancelling is not a refusal of money: if the customer pays anyway, late money wins.

Your own payment page

If you show the UPI QR or bank details yourself (instructions.type upi_qr or bank_details), send the customer's payment reference (UTR) with POST/v1/payins/{id}/reference. A reference already used for another pay-in is refused with reference_already_used.

USDT

Each customer gets one permanent deposit address per chain (tron or bsc). Asking again returns the same address; it is never given to anyone else.

runs in CI samples/ts/crypto-address.ts
// USDT: each customer gets one permanent deposit address per chain. Ask as often as you
// like — it is a get-or-create and always returns the same address.
//   bun crypto-address.ts player-7591035 bsc
import { nicepay, NicePayError } from "./nicepay.ts";

const customerRef = process.argv[2] ?? "player-7591035";
const chain = process.argv[3] ?? "tron"; // "tron" or "bsc"

async function depositAddress(): Promise<string> {
  for (let attempt = 0; ; attempt += 1) {
    try {
      return (await nicepay<{ address: string }>("POST", "/v1/crypto/addresses", { body: { customer_ref: customerRef, chain } })).address;
    } catch (error) {
      // A new address comes from a pool filled in advance; if it is momentarily empty, wait and ask again.
      if (error instanceof NicePayError && error.code === "address_pool_empty" && attempt < 5) {
        await new Promise((resolve) => setTimeout(resolve, 2000));
        continue;
      }
      throw error;
    }
  }
}

const first = await depositAddress();
const second = await depositAddress();
console.log(`${customerRef} on ${chain}: ${first} (stable: ${String(first === second)})`);
// Every confirmed transfer to it becomes its own pay-in (payin.succeeded with the amount received).

In test mode, addresses are real-format addresses that nothing watches; simulated USDT transfers are not available yet.

Mistakes that lose money

Imported pay-ins

If your platform moved to Nice Pay from its own payment system, its past pay-ins may have been imported so you can find them here. They come back from the same endpoints with imported: true and legacy_id (your old system's id); every pay-in made at Nice Pay has imported: false and legacy_id: null. An imported pay-in moved no money at Nice Pay: no balance, no event. A reversed imported deposit shows succeeded with reversed_at; instructions.type is none; fee is null. Any write request on one (cancel, reference, check) answers 409 imported_record.