Nice Paydocs API version 2026-12-01 OpenAPI

Payouts

A payout sends money from your balance to your customer: a player's withdrawal.

Create one

POST /v1/payoutsReference

A key with payouts:write always has an IP allowlist; use an Ed25519 key for it if you can.

Request

FieldNotes
merchant_payout_idyour withdrawal id: 1 to 64 characters of A–Z a–z 0–9 _ . : -; unique per project forever
amount, currency"5000.00", "INR" (USDT methods take "USDT")
methodupi, bank_transfer, usdt_trc20, usdt_bep20. A payout never names a channel: Nice Pay chooses. upi only when UPI payouts are on for your account
destinationupi: { vpa, holder_name } · bank_transfer: { account_number, ifsc, holder_name } · USDT: { address }
customer.refoptional, your customer's id
customer.name, customer.phone, customer.emailoptional, your customer's name, mobile number and e-mail. Some channels need the mobile (and an e-mail, formed from customer.ref when you send none): a payout without a mobile is never sent to them — another of your routes takes it, or it waits until one can. Send them whenever you have them; they are never returned. The pay-ins page has the details
risk_hintsdeprecated and ignored: player risk is yours, and Nice Pay does not score payouts. Still accepted for one release; stop sending it
metadataoptional, up to 20 keys with string values
descriptionoptional: why — e.g. "player withdrawal 4711" (at most 200 characters); shown on the payment, in exports and in its payment record

Destinations are checked strictly — IFSC format, VPA format, address checksum for the stated chain. A Tron address on a BNB Smart Chain payout is refused, never guessed.

Response

201 with the payout, in status queued. destination comes back masked.

Errors

CodeWhen
422 invalid_destinationthe destination is malformed or does not match the method
409 duplicate_merchant_referencea payout with this merchant_payout_id exists; existing_id is its id
403 merchant_not_activeyour account is frozen or closed
422 amount_too_small(live mode) the amount is below your smallest payout in that currency; min_amount and max_amount give your range
403 limit_exceeded(live mode) the amount is above your largest payout: limit is amount_max, with min_amount and max_amount
422 method_not_availablethe method is not priced for your project; a upi payout while UPI payouts are off for your account (live mode: only the UPI channel or a Nice Pay desk pays UPI IDs — send it as bank_transfer); or Nice Pay has switched that currency off for you (live mode): switched_off is fiat (INR) or crypto (USDT)
400 invalid_requesta field is wrong; errors names it

Nothing is created and nothing is reserved when a request is refused. A short balance is not a refusal: the payout is created unfunded.

Your limits are the same as for pay-ins: unless agreed otherwise ₹300 to ₹20,000 and 5 to 50,000 USDT per payout, in live mode (your limits). A payout created while its currency was on and switched off before Nice Pay starts on it waits for a person at Nice Pay (held), who sends it on or rejects it (the amount and fee come back to you once). A USDT payout's fee is 1 % plus a flat amount per chain (0.50 USDT on BEP20, 2.50 USDT on TRC20) unless agreed otherwise; GET/v1/methods gives yours.

Example

runs in CI samples/ts/payouts.ts samples/php/payouts.php
// Payouts: pay a player's withdrawal exactly once, and never guess at an unknown outcome.
//   bun payouts.ts WD-99120
import { nicepay, NicePayError, NoAnswerError } from "./nicepay.ts";

interface Payout {
  readonly id: string;
  readonly status: string;
  readonly fee: string;
  readonly reference: string | null;
  readonly destination: { readonly masked: string };
}

const withdrawalId = process.argv[2] ?? `WD-${String(Date.now())}`;

let payout: Payout;
try {
  payout = await nicepay<Payout>("POST", "/v1/payouts", {
    body: {
      merchant_payout_id: withdrawalId, // your withdrawal id: unique forever
      amount: "1000.00",
      currency: "INR",
      method: "upi",
      destination: { vpa: "ramesh@okhdfc", holder_name: "Ramesh Kumar" },
      customer: { ref: "player-7591035" },
    },
    idempotencyKey: withdrawalId, // and the idempotency key: a retry never pays twice
  });
} catch (error) {
  if (error instanceof NoAnswerError && error.outcomeUnknown) {
    // We do not know whether Nice Pay received it. Keep the withdrawal "processing" on
    // your side and send the same call again later with the same key. Never pay the
    // player another way and never put the money back on a guess.
    console.log(`unknown outcome for ${withdrawalId}: retry later with the same idempotency key`);
    process.exit(1);
  }
  if (error instanceof NicePayError && error.code === "insufficient_balance") {
    console.log("not enough available balance: nothing was created");
    process.exit(1);
  }
  throw error;
}
console.log(`payout ${payout.id}: ${payout.status}, fee ${payout.fee}, to ${payout.destination.masked}`);

// Test mode only: the bank pays it.
await nicepay("POST", `/v1/test/payouts/${payout.id}/simulate`, { body: { action: "succeed" } });

for (let i = 0; i < 30; i += 1) {
  const now = await nicepay<Payout>("GET", `/v1/payouts/${payout.id}`);
  // processing / sent: the money may be on its way — never pay the player again.
  if (now.status === "succeeded" || now.status === "failed" || now.status === "cancelled" || now.status === "reversed") {
    console.log(`final: ${now.status}, reference ${String(now.reference)}`);
    process.exit(0);
  }
  await new Promise((resolve) => setTimeout(resolve, 1000));
}
throw new Error("the payout did not finish within 30 seconds");

Statuses

Text
queued ──► processing ──► sent ──► succeeded ──► reversed   (paid, later returned by the bank)
   │            │           │
   │            └───────────┴────► failed                   (amount and fee released back to you)
   └──► cancelled

queued waitingprocessing in progresssent in progresssucceeded finished wellfailed went wrongcancelled overreversed needs a look

Find payouts

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)

Why a payout was not paid

Every failed or cancelled payout, and its payout.failed event, carries failure_reason:

ValueMeaning
expirednothing had started paying it within your expiry hours (24 unless agreed otherwise), counted from your request
cancelled_by_merchantyou cancelled it
cannot_paythe desk it was given could not pay it
destination_rejectedNice Pay ended it: the destination was refused
rail_closedNice Pay ended it: the rail is closed
provider_refusedthe gateway or the chain refused or failed the transfer
rejected_by_staffNice Pay staff ended it
timed_out_by_staffNice Pay's withdrawal timeout ended it
negative_balanceit waited for funds and was not funded in time

Refund your customer once on any of them. There is no separate "expired" event: an expired payout is payout.failed with failure_reason: expired.

Its record

GET/v1/payouts/{id} also gives the payout's timeline — every step, oldest first: requested, funded, admitted or held, approved, assigned (a gateway, a Nice Pay desk or the chain executor), sent_to_provider, provider_answered, paid, completed, failed, cancelled or reversed, each with its time and, where there is one, why — and durations: seconds_to_assign, seconds_at_processor and seconds_total. Nice Pay staff are never named. The list does not carry them. GET/v1/payins/{id} gives durations.seconds_to_receive; a USDT pay-in names each transfer's from_address, and an INR pay-in its payer (masked) when the gateway or desk reports it. The merchant portal downloads a payment's whole record as a file.

Cancel one

POST /v1/payouts/{id}/cancelReference

You can cancel a payout while nothing has started paying it — it may already be processing, waiting for a desk.

AnswerWhen
200, status: cancelled, failure_reason: cancelled_by_merchantit was cancelled; the amount and fee are back in your available balance. Cancelling it again answers the same
409 payout_in_progressa desk, a gateway or the chain holds it, it was sent, or its outcome is being checked: it cannot be cancelled and ends with its real outcome. Do not refund on this answer
409 invalid_stateit already ended another way: read it back for its status

Mistakes that lose money

Imported payouts

If your platform moved to Nice Pay from its own payment system, its past payouts 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 payout made at Nice Pay has imported: false and legacy_id: null. An imported payout moved no money at Nice Pay: no balance, no event. fee is 0.00; amount is null only when your old system never recorded the USDT actually sent. Any write request on one (cancel, reference, check) answers 409 imported_record.