KashierDevelopersKashier Developers
Dashboard API

Error responses

Error response format and common error scenarios

Kashier returns more than one error shape. Business-logic errors use the standard envelope below. Authentication, schema, and validation errors return their own flat shapes instead. Branch your error handling on the HTTP status code first, then on which keys are present.

Standard error envelope (operational errors)

Most business-logic errors — invalid merchant configuration, invalid request objects, and similar — use a shared envelope:

{
   "error": {
       "cause": string       // The technical cause of the error
   },
   "messages": {
       "en": string,        // English error message
       "ar": string         // Arabic error message
   },
   "status": "FAILURE"      // Always "FAILURE" for this envelope
}

Not every error uses this envelope

Authentication, authorization, schema, and request-validation failures return a flat { "message": ... }, an { "error": ... } string, or a { "more_info": [...] } array — with no messages object and no status field. Do not require status to be present before treating a non-2xx response as an error.

Common error scenarios

Invalid merchant ID

Returned when the merchant identifier is missing, malformed, or not recognised:

{
    "error": {
        "cause": "The request object is invalid"
    },
    "messages": {
        "en": "Invalid merchant ID",
        "ar": "Invalid merchant ID"
    },
    "status": "FAILURE"
}

Troubleshooting authentication and permission errors

StatusWhat to check
400The request is invalid — check the headers and parameters you sent.
401 or 403The credential, its permissions, or the calling IP is not allowed. Check the key's status, mode, permissions and IP allow-list.

For details, see Authentication and Secret keys. Check the key's status, mode, IP allow-list and permissions. For payouts, see Allow-list your IP address.

Validation errors (400)

Validation errors come in two shapes. Check which one you're looking at before parsing.

Schema validation

Requests that fail request-schema validation (missing or malformed fields at the schema level) return only a list of the individual violations:

{
   "more_info": [
       { "message": "should have required property 'amount'" }
   ]
}
FieldTypeMeaning
more_infoarrayThe individual schema validation errors that were found.

HTTP status: 400. There is no message, messages, or status key on this shape.

Field-level (body/query/param) validation

Most other input validation — required fields, format checks on individual body, query, or param values — returns a flat, localized message instead:

{
  "message": "merchant ID is required"
}
FieldTypeMeaning
messagestringThe first validation error found, localized based on your request's language header.

HTTP status: 400. Only the first error is returned even when several fields are invalid, so fix and re-send rather than expecting the full list.

Non-operational / unknown errors

An unexpected server-side failure does not use the envelope. It returns a flat message only:

{
   "message": "Internal server error"
}

A temporary service outage surfaces here rather than through the standard envelope.

Live-mode-only routes

Some routes only operate in live mode and reject calls made with test credentials.

Duplicate / conflicting records (409)

Returned when a request would create a record whose unique field already exists — for example reusing an invoice number, a category name, or a payment-request reference for the same merchant:

{
   "status": 409,
   "message": "The invoice number has already been used. Please enter another invoice number.",
   "code": "DUPLICATE_KEY_ERROR"
}

Match on code: "DUPLICATE_KEY_ERROR" rather than on the message text, which varies by the conflicting field:

Conflicting field(s)Message
Invoice referenceThe invoice number has already been used. Please enter another invoice number.
Category name (slug)The category name has already been used. Please enter another category name.
merchantId + referenceId (payment requests)A payment request with merchantId "..." and referenceId "..." already exists.
Any other duplicate keyA duplicate key error occurred. Please check your input and try again.

Retrying a 409 with the same payload will fail again. Change the conflicting value or treat the existing record as the result.

Other errors return 400 with a message.

Quick reference by source

The top-level keys differ by error type — some responses use error.cause / messages / status, others use a flat message, an error string, or a more_info array. Branch your client error handling on the HTTP status code together with whichever of these keys is present in the body.

Error sourceHTTP statusTop-level keys
Operational / business-logic errorvarieserror.cause, messages.{en,ar}, status: "FAILURE"
Non-operational / unexpected errorvariesmessage
Schema validation400more_info[]
Field-level validation400message
Authentication or permission failure401 or 403message (or error, message)
Invalid request400message or error
Live-mode-only route called with test credentials403message
Duplicate key / conflicting record409status, message, code: "DUPLICATE_KEY_ERROR"

Best practices

  1. Treat any non-2xx HTTP status as an error. Do not rely on a status field being present — several error paths omit it
  2. Read the message from messages.en when present, and fall back to the flat message or error key, then to more_info
  3. Handle both English and Arabic messages appropriately based on your user's locale
  4. Pay special attention to the error.cause field for debugging purposes
  5. For authorization errors, verify your API key, your hash generation process, and the secret key's status, mode, IP allow-list and permissions
  6. Match 409 conflicts on code: "DUPLICATE_KEY_ERROR" and do not blind-retry them
  7. In live mode, ensure your account has the necessary credentials configured for each operation

On this page