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 payout amount plus fee",
  "request_id": "req_01JD3QH2Y8ZKX4M9T6V0R1B2C3",
  "errors": [{ "field": "amount", "message": "…" }]
}

The SDKs raise NicePayError (TypeScript) / NicePay\Exception\ApiException (PHP) with code (PHP: errorCode), status, requestId, retryable, detail and errors; and a connection 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, NicePayConnectionError, NicePayError } 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"] } : {}),
});

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 NicePayConnectionError) {
      console.log(`${label}: no answer, outcome unknown=${String(error.outcomeUnknown)}`);
    } else {
      throw error;
    }
  }
}

// 402: more than the available balance. Nothing is created.
await attempt("huge payout", () =>
  nicepay.createPayout({ merchant_payout_id: `WD-HUGE-${String(Date.now())}`, amount: "99999999.00", currency: "INR", method: "upi", destination: { vpa: "ramesh@okhdfc", holder_name: "Ramesh Kumar" } }),
);
// 400: the request does not match the schema; `errors` names the fields.
await attempt("bad amount", () => nicepay.createPayin({ merchant_order_id: "DEP-BAD", amount: "10.999", currency: "INR", method: "upi", customer: { ref: "p1" } }));
// 404: an id that is not yours (or does not exist) — the same answer either way.
await attempt("unknown pay-in", () => nicepay.getPayin("pi_00000000000000000000000000"));
// 422: fees would leave you nothing.
await attempt("tiny pay-in", () => nicepay.createPayin({ merchant_order_id: `DEP-TINY-${String(Date.now())}`, amount: "1.00", currency: "INR", method: "upi", customer: { ref: "p1" } }));

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 is no longer queued). Fetch the object and act on its current status.
limit_exceeded403A limit applies — for example a customer's number of open pay-ins, or the number of webhook endpoints of a project; detail says which. 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; the SDKs do this for you.
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. The SDKs wait and retry.

Limits

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