Nice Paydocs API version 2026-12-01 OpenAPI

Settlements and balances

Your balance is what we hold for you. A settlement moves part of it to a bank account or USDT address of yours.

Balances

GET/v1/balances (scope balances:read) gives, per currency:

A hold is one item: it is never merged with another or released in part. When it is released, exactly its amount returns to available. If you have a question about a hold, quote its id to your account manager.

Every movement is a balance transaction (GET/v1/balance-transactions): the ledger entries of your account, newest first, cursor-paged. Use them to reconcile — they add up to your balance exactly. account says which balance an entry is on (available, pending, reserved, held, debt).

Three types carry a note written for you, and null everywhere else: hold.place (why an amount was put on hold: one entry out of available, one into held), hold.release (why it was released: the same amount back) and balance.recover (an amount Nice Pay took back from your balance or from a hold, with the reason).

runs in CI samples/ts/balances.ts
// Balances and the statement: reconcile your books against every ledger entry.
import { NicePay, Money, type BalanceTransaction } from "@nicepay/sdk-ts";

const nicepay = new NicePay({
  keyId: process.env["NICEPAY_KEY_ID"] ?? "",
  secret: process.env["NICEPAY_KEY_SECRET"] ?? "",
  ...(process.env["NICEPAY_API_BASE"] ? { baseUrl: process.env["NICEPAY_API_BASE"] } : {}),
});

const balances = await nicepay.getBalances();
for (const b of balances.data) {
  console.log(`${b.currency}: available ${b.available}, pending ${b.pending}, reserved ${b.reserved}, held ${b.held}`);
  // Each hold is its own item, with the reason it was placed.
  for (const h of b.holds) console.log(`  on hold ${h.amount} since ${h.placed_at}: ${h.comment} (${h.id})`);
}

// Every entry, page by page (newest first). Add them up with Money — never with floats.
const entries: BalanceTransaction[] = [];
let startingAfter: string | undefined;
for (;;) {
  const page = await nicepay.listBalanceTransactions({ currency: "INR", limit: 100, ...(startingAfter ? { starting_after: startingAfter } : {}) });
  entries.push(...page.data);
  if (!page.has_more) break;
  startingAfter = page.data.at(-1)?.id;
}
let available = Money.of("0", "INR");
for (const e of entries) if (e.account === "available") available = available.add(Money.of(e.amount, e.currency));
const inr = balances.data.find((b) => b.currency === "INR");
console.log(`${String(entries.length)} entries; available entries sum to ${available.toString()} (balance ${String(inr?.available)})`);

Settle your balance

A settlement moves available balance to a bank account (or USDT address) of yours.

POST /v1/settlementsReference

FieldNotes
amount, currency"25000.00", "INR"
destination_idone of your destinations, from GET/v1/settlement-destinations
runs in CI samples/ts/settlements.ts samples/php/settlements.php
// Settlements: move your available balance to a bank account registered in the portal.
//   bun settlements.ts 2500.00
import { NicePay } from "@nicepay/sdk-ts";

const nicepay = new NicePay({
  keyId: process.env["NICEPAY_KEY_ID"] ?? "",
  secret: process.env["NICEPAY_KEY_SECRET"] ?? "",
  ...(process.env["NICEPAY_API_BASE"] ? { baseUrl: process.env["NICEPAY_API_BASE"] } : {}),
});

const amount = process.argv[2] ?? "2500.00";

// Destinations are added in the merchant portal (with a second factor), never by API,
// and can be used only after their cooling-off period.
const destinations = await nicepay.listSettlementDestinations();
const usable = destinations.data.find((d) => d.usable);
if (!usable) throw new Error("no destination is past its cooling-off period yet");

const balances = await nicepay.getBalances();
const inr = balances.data.find((b) => b.currency === "INR");
console.log(`available ${String(inr?.available)} INR; settling ${amount} to ${usable.masked}`);

// One settlement per request id of yours: a retry returns the same settlement.
const requestId = `SETTLE-${new Date().toISOString().slice(0, 10)}-${amount}`;
const settlement = await nicepay.createSettlement({ amount, currency: "INR", destination_id: usable.id }, { idempotencyKey: requestId });
console.log(`settlement ${settlement.id}: ${settlement.status}, fee ${settlement.fee}`);

const again = await nicepay.getSettlement(settlement.id);
console.log(`listed: ${String((await nicepay.listSettlements({ limit: 10 })).data.some((s) => s.id === again.id))}`);

Top-ups

If you prefund your balance (bank transfer, or USDT to your project's top-up address from GET/v1/topup-addresses), each top-up appears in GET/v1/topups, raises topup.succeeded, and shows as a balance transaction of type topup.

Mistakes that lose money