External API

Developer documentation

Integrate online and POS payments, query operations, and receive webhooks with the Avirato Payments external API.

Error Handling

Standard error format

All error responses follow this format:

{
  "success": false,
  "error": {
    "message": "Human-readable error description",
    "code": 12001,
    "statusCode": 400,
    "traceId": "abc123def456..."
  }
}
FieldDescription
messageError description in English
codeInternal error code (see table below)
statusCodeHTTP response code
traceIdUnique identifier for technical support

Security note: Internal server errors (5xx) return a generic message ("An error has occurred...") to avoid exposing implementation details. The traceId lets the support team investigate the specific error.

Note on environments: Error codes, formats, and messages are identical in Live and Test environments. There are no differences in error handling between environments.

Error code catalog

Authentication and authorization errors (11xxx)

CodeHTTPDescriptionRecommended action
11001403Invalid or missing API keyVerify the X-API-KEY header
11002403IP not allowedConfigure your IP in the dashboard (Integrations > API Keys)
11008403Access denied to the resourceWebcode mismatch, payment not created via External API, or environment error

Validation errors (12xxx)

CodeHTTPDescriptionRecommended action
12001400Missing required parameter or invalid formatReview required fields and their formats
12002400Incorrect date formatUse ISO 8601 format (e.g. 2026-07-15T14:00:00Z)
12006400Invalid country formatUse ISO 3166-1 alpha-2 (e.g. ES, FR, DE)
12009400Country not supportedContact support for the list of available countries

Resource errors (10xxx)

CodeHTTPDescriptionRecommended action
10404404Resource not foundVerify that sessionId or paymentReference is correct

POS errors (13xxx)

CodeHTTPDescriptionRecommended action
13001500Payment provider errorRetry after a few seconds. If it persists, contact support
13004502Terminal communication errorVerify that the terminal is powered on and connected
13005409Terminal busyWait for the current transaction to finish and try again

Idempotency conflicts (409)

These conflicts do not carry an internal numeric code: the message distinguishes them from the POS busy 409 (13005).

CaseHTTPMessage (literal)Recommended action
Same Idempotency-Key, different body409Idempotency key reused with a different request body.Use a new key or resend the same body as the original request
Same Idempotency-Key, different endpoint409Idempotency key already used for a different endpoint.Do not reuse the same key across different endpoints

Internal errors (99xxx)

CodeHTTPDescriptionRecommended action
99001500Internal server errorNote the traceId and contact support

Example error response

{
  "success": false,
  "error": {
    "message": "External device is busy.",
    "code": 13005,
    "statusCode": 409,
    "traceId": "b2f3d36dc305249e8d1ebaa49ef616f1"
  }
}

Best practices

Retries

  • 4xx errors: Do not retry (the problem is in the request)
  • 5xx errors: Retry with exponential backoff (1s, 2s, 4s, 8s...)
  • 409: if it is 13005 (terminal busy), wait 5-10 seconds and retry. If the message starts with Idempotency key…, do not retry blindly: fix the key or the request body
  • Always use Idempotency-Key so retries are safe (but make sure not to reuse it with a different body)

Logging

Log the traceId from error responses to simplify communication with technical support.

Pre-validation

Validate data before sending the request to avoid 400 errors:

  • amount.value must be a positive integer (cents)
  • amount.currency must be exactly 3 uppercase letters (EUR, GBP, or USD)
  • webcode cannot be empty
  • URLs (urlOk, urlKo) must be valid URLs with a protocol
  • reason on refunds must be one of the 5 exact allowed values