OI Payments Docs
Core concepts

Responses & errors

The single response envelope every endpoint returns, pagination, and the full error-code catalogue.

Every endpoint — success or failure — returns the same JSON envelope.

The envelope

{
  "data": { "...": "the payload (or null)" },
  "meta": {
    "success": true,
    "message": "optional human-readable message",
    "errorCode": null,
    "timestamp": "2026-06-04T10:00:00Z"
  },
  "pagination": null
}
FieldMeaning
dataThe payload on success. For list endpoints, this is the page's items.
meta.successBoolean outcome flag.
meta.messageOptional narrative (e.g. "Resource created" or an error description).
meta.errorCodeStable machine-readable code on failure (see below); null on success.
meta.timestampServer UTC instant.
paginationPresent only on list endpoints.

Branch on meta.errorCode, not on meta.message — messages are for humans and may change; codes are part of the contract and never change meaning.

Pagination

List endpoints put the items in data and the page info in pagination:

{
  "data": ["...items..."],
  "meta": { "success": true, "timestamp": "2026-06-04T10:00:00Z" },
  "pagination": { "page": 0, "size": 20, "totalElements": 137, "totalPages": 7 }
}

Pages are zero-indexed. Pass page and size as query parameters; most list endpoints also accept sortBy and order (ASC/DESC).

Error codes

Errors return the envelope with meta.success = false and a meta.errorCode. The HTTP status reflects the category.

errorCodeHTTPMeaning
VALIDATION_ERROR400Request failed validation; data holds a field → message map.
UNAUTHORIZED401Missing/invalid credentials.
TOKEN_EXPIRED / SESSION_EXPIRED401Admin session no longer valid.
REAUTH_REQUIRED401Admin must re-authenticate before a sensitive action.
INVALID_CREDENTIALS401Bad email/password (admin login).
FORBIDDEN403Authenticated but not permitted.
RESOURCE_NOT_FOUND404No such resource in your scope.
RESOURCE_ALREADY_EXISTS409Uniqueness conflict.
INVALID_OPERATION_STATE409The resource isn't in a state that allows the action.
IDEMPOTENCY_KEY_CONFLICT409Same idempotency key, different body.
IDEMPOTENCY_IN_PROGRESS409Same idempotency key still processing.
LAST_SUPER_ADMIN_PROTECTED409Cannot disable the last Super Admin.
LEDGER_ALREADY_REVERSED409A ledger entry was asked to be reversed twice.
ACCOUNT_LOCKED / ACCOUNT_DISABLED403Admin account not usable.
WEAK_PASSWORD400Password does not meet policy.
PAYMENT_GATEWAY_ERROR502The gateway was unreachable or rejected the operation.
LEDGER_UNBALANCED500Internal invariant breach (debits ≠ credits).
INTERNAL_ERROR500Unexpected server error.

Validation errors

A 400 VALIDATION_ERROR puts the per-field messages in data:

{
  "data": { "amountMinor": "must be greater than 0" },
  "meta": { "success": false, "errorCode": "VALIDATION_ERROR",
            "message": "Validation failed", "timestamp": "…" }
}

On this page