Errors

minnha returns standard HTTP status codes and a JSON body following RFC 7807 (Problem Details).

Shape

json
{
  "timestamp": "2026-05-26T12:34:56.789Z",
  "status": 400,
  "error": "Bad Request",
  "message": "amount must be greater than 0.01",
  "path": "/api/v1/sessions"
}

HTTP status codes

StatusMeaningRetry?
200 OKSuccess
400Validation error (missing/bad input)No — fix the input
401Missing or invalid API keyNo
403Authenticated but missing permissionNo
404Resource not found / not yoursNo
409Conflict (e.g. duplicate Idempotency-Key with different body)No
422Business rule rejected (e.g. refund > captured)No
429Rate-limitedYes, with backoff
5xxServer errorYes — SDKs do this automatically

SDK error classes

ts
import {
  MinnhaError,           // base class
  MinnhaApiError,        // any non-2xx
  MinnhaAuthError,       // 401 / 403
  MinnhaValidationError, // 400 / 422
  MinnhaNetworkError,    // timeout, DNS, ECONNRESET
  MinnhaSignatureError,  // webhook HMAC mismatch
} from "@minnha/node";

try {
  await minnha.sessions.create({ amount: 0, currency: "SAR" });
} catch (err) {
  if (err instanceof MinnhaValidationError) {
    console.error(err.message);  // "amount must be greater than 0.01"
    console.error(err.requestId); // helpful for support
  }
}

Retry strategy

The Node SDK retries 408 / 425 / 429 / 5xx errors automatically with exponential backoff (2 attempts by default, jittered). For your own code, follow the same pattern.