Nice Paydocs API version 2026-12-01 OpenAPI

Errors

Every error is an RFC 9457 problem with a stable code:

JSON
{
  "type": "https://docs.mynicepanel.com/errors/insufficient_balance",
  "title": "Insufficient balance",
  "status": 402,
  "code": "insufficient_balance",
  "detail": "the available balance is lower than the settlement amount plus fee",
  "request_id": "req_01JD3QH2Y8ZKX4M9T6V0R1B2C3",
  "errors": [{ "field": "amount", "message": "…" }]
}
JSON
{
  "type": "https://docs.mynicepanel.com/errors/limit_exceeded",
  "title": "Limit exceeded",
  "status": 403,
  "code": "limit_exceeded",
  "detail": "wait 60 seconds between pay-ins",
  "request_id": "req_01JD3QH2Y8ZKX4M9T6V0R1B2C4",
  "limit": "customer_gap",
  "retry_after_seconds": 47
}
JSON
{
  "type": "https://docs.mynicepanel.com/errors/limit_exceeded",
  "title": "Limit exceeded",
  "status": 403,
  "code": "limit_exceeded",
  "detail": "the largest INR payout is 20000.00",
  "request_id": "req_01JD3QH2Y8ZKX4M9T6V0R1B2C5",
  "limit": "amount_max",
  "min_amount": "300.00",
  "max_amount": "20000.00"
}

In the examples, the signing helper turns a problem into an error object, NicePayError, with status, code (PHP: errorCode), requestId, retryable and the whole problem; and into a separate error with outcomeUnknown when there was no answer at all (idempotency).

runs in CI samples/ts/errors.ts samples/php/errors.php
// Errors: every failure has a stable code, a request id for support, and whether
// sending it again can help.
import { nicepay, NicePayError, NoAnswerError } from "./nicepay.ts";

async function attempt(label: string, call: () => Promise<unknown>): Promise<void> {
  try {
    await call();
    console.log(`${label}: ok`);
  } catch (error) {
    if (error instanceof NicePayError) {
      // error.code is one of the documented codes; switch on it, not on the message.
      const fields = error.errors.map((e) => e.field).join(",");
      console.log(`${label}: ${String(error.status)} ${error.code} retryable=${String(error.retryable)} request_id=${String(error.requestId)}${fields ? ` fields=${fields}` : ""}`);
    } else if (error instanceof NoAnswerError) {
      console.log(`${label}: no answer, outcome unknown=${String(error.outcomeUnknown)}`);
    } else {
      throw error;
    }
  }
}

const stamp = String(Date.now());
// 422: the destination is not a valid UPI ID. Nothing is created (a short balance is not an error: the payout waits for funds).
await attempt("bad destination", () =>
  nicepay("POST", "/v1/payouts", {
    body: { merchant_payout_id: `WD-BAD-${stamp}`, amount: "100.00", currency: "INR", method: "upi", destination: { vpa: "not a upi id", holder_name: "Ramesh Kumar" } },
    idempotencyKey: `WD-BAD-${stamp}`,
  }),
);
// 400: the request does not match the schema; `errors` names the fields.
await attempt("bad amount", () =>
  nicepay("POST", "/v1/payins", { body: { merchant_order_id: "DEP-BAD", amount: "10.999", currency: "INR", method: "upi", customer: { ref: "p1" } }, idempotencyKey: `DEP-BAD-${stamp}` }),
);
// 404: an id that is not yours (or does not exist) — the same answer either way.
await attempt("unknown pay-in", () => nicepay("GET", "/v1/payins/pi_00000000000000000000000000"));
// 422: fees would leave you nothing.
await attempt("tiny pay-in", () =>
  nicepay("POST", "/v1/payins", { body: { merchant_order_id: `DEP-TINY-${stamp}`, amount: "1.00", currency: "INR", method: "upi", customer: { ref: "p1" } }, idempotencyKey: `DEP-TINY-${stamp}` }),
);

Every code

CodeHTTPWhat to do
missing_credentials401A signing header is missing (NP-Key-Id, NP-Timestamp, NP-Nonce, NP-Algorithm, NP-Signature), or NP-Nonce is not 16+ random bytes in base64url without padding. Fix the client; do not retry as is.
invalid_key401The key id is malformed, unknown, revoked or expired. Check that you send the key id (np_test_kid_… or np_live_kid_…), not the secret, and that the key was not revoked in the portal.
invalid_signature401The signature does not match. Compare your canonical string with the test vectors: raw body bytes, sorted query, no trailing newline, the right secret, NP-Algorithm matching the key.
timestamp_out_of_range401NP-Timestamp is more than 300 seconds from our clock, or is not whole seconds (milliseconds are refused). Sync your server's clock (NTP) and sign each attempt afresh.
nonce_reused401This key already used this nonce. Generate a new random nonce for every request, including every retry.
ip_not_allowed403The request came from an address outside the key's IP allowlist. The list is fixed when a key is created: create a key that includes your server's egress address, then revoke this one.
edge_auth_failed403The request did not come through our edge. Use https://api.mynicepanel.com, never another host or an IP address.
insufficient_scope403The key lacks the scope this endpoint needs (see the reference). Create a key with that scope in the portal.
test_mode_only403Simulation endpoints work with test keys only.
merchant_not_active403Your merchant account is closed, or it is frozen and you asked for a payout or a settlement. Contact your account manager.
invalid_request400The request does not match the schema; errors names each field. Fix the request; retrying the same one fails the same way.
amount_too_small422The fees would leave you nothing of this amount. Ask for a larger amount; nothing was created.
invalid_destination422The payout destination is malformed or does not match the method (IFSC, VPA, address checksum and chain). Correct it; nothing was created.
unsupported_version400NP-Version names a version we do not serve. Send a supported version date or omit the header.
idempotency_key_required400This endpoint creates or moves money: send an Idempotency-Key (your own order or withdrawal id).
idempotency_key_reused409This idempotency key was used with a different request body. Use a new key for a new request; never change the body of a retry.
request_in_progress409A request with this idempotency key is still running. Retry the same request (same key) after a short wait.
duplicate_merchant_reference409An object with this merchant_order_id / merchant_payout_id already exists; existing_id is its id. Fetch it instead of creating another.
reference_already_used409This payment reference (UTR) was already submitted for another pay-in. Ask the customer to check it.
not_found404No such object for this key's project and mode. Check the id and that you use the key of the mode the object was created in.
invalid_state409The object's status does not allow this (e.g. cancelling a payout that has already failed or succeeded). Fetch the object and act on its current status.
payout_in_progress409The payout is being paid, or may be (a desk, a gateway or the chain holds it, it was sent, or its outcome is being checked). It cannot be cancelled; it ends with its real outcome, which a webhook tells you. Do not refund your customer on this answer.
imported_record409This payment was imported from your platform's old system so its past is searchable here. It is a record: it cannot be cancelled, referenced or changed, and it moved no money in Nice Pay. Handle it in the old system, or raise it with Nice Pay staff.
gone410This route was removed. It answers 410 for one release, then no longer exists; detail says what replaced it. Stop calling it.
outside_working_hours409You asked for a settlement outside the working hours (09:00–18:00 IST; working_hours and timezone say which), and detail carries the warning: "This is not working hours. The payment gets delayed, and it can cause deviation in treasury calculations if it's not settled today." Nothing was created. Show the warning to whoever asked; if they still want it, send the same request again with outside_hours_ack: true (a new idempotency key is fine: the refused one was not kept).
limit_exceeded403A limit applies — for example a customer's number of open pay-ins, the time between two of their pay-ins, or the number of webhook endpoints of a project. limit names it, limit_max says how many a count allows and retry_after_seconds how long a customer waits before asking again; tell your customer that, not something else. Nothing was created.
insufficient_balance402The available balance is lower than the amount plus fee. Nothing was created; top up, or wait for pending money to become available.
rail_unavailable503No rail can serve this request now. Retry later or offer the customer another method.
address_pool_empty503No deposit address is ready this moment. Retry after a few seconds.
invoice_already_open409This customer already has an open USDT invoice on this chain. Use the open one, or cancel it first.
method_not_available422This method or settlement is not configured for your project. Contact your account manager.
rate_limited429Too many requests for this key. Wait for Retry-After seconds, then send it again.
internal_error500Something failed on our side. Retry with the same idempotency key; quote request_id if it persists.
service_unavailable503We are briefly unavailable. Retry with the same idempotency key after a short wait.

Rate limits

Each key has separate per-minute buckets for reads, pay-in creation and payout creation. Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset; over the limit you get 429 rate_limited with Retry-After. Wait that many seconds and send the request again; a 429 was refused before anything ran, so repeating it is always safe.

Limits

Request bodies are at most 64 KB. Lists return at most 100 objects per page.