Skip to main content

Error Response Structure

All errors follow a consistent format:

HTTP Status Codes

Common Error Codes

MISSING_ACCESS_TOKEN

  • Message: Access token is required
  • Cause: The X-Access-Token header is missing
  • Action: Include your API key in the header

INVALID_ACCESS_TOKEN / ERR_AUTH

  • Message: The provided access token is invalid
  • Cause: API key is incorrect, expired, or revoked
  • Action:
    • Verify API key is correct
    • Generate a new key if needed
    • Don’t log sensitive key values
    • Contact support if issue persists

NO_BALANCE / INSUFFICIENT_BALANCE

  • Message: Insufficient balance
  • Cause: Account balance is too low
  • Action:
    • Check balance using /v3/account/balance before operations
    • Display current balance to user
    • Offer top-up option
    • Don’t retry without adding funds

DUPLICATED_REF

  • Message: This reference ID is already in use
  • Cause: Reference already used in previous request
  • Action:
    • Check status of existing order
    • Generate new unique reference
    • Don’t create duplicate orders

IP_BLOCKED

  • Message: Your IP has been temporarily blocked
  • Cause: Too many failed authentication attempts
  • Action:
    • Wait 15 minutes for automatic unblock
    • Verify correct API key
    • Contact support if persists

IP_NOT_ALLOWED

  • Message: Your IP address is not whitelisted
  • Cause: IP whitelisting is enabled
  • Action: Add your IP to whitelist in dashboard

ERR_VALIDATION

  • Message: Validation error
  • Cause: Request parameters don’t meet requirements
  • Common Issues: Missing fields, invalid data types, pattern mismatch
  • Action:
    • Validate input client-side first
    • Check error.details for specific field issues
    • Don’t retry without fixing the issue

ERR_PHONE

  • Message: Invalid phone number
  • Cause: Phone number is incorrect or doesn’t exist
  • Action: Use /v3/internet/check-number to validate first

ERR_STOCK

  • Message: Product out of stock
  • Cause: Requested product/card value is not available
  • Action:
    • Check stock before ordering
    • Offer alternative denominations
    • Retry later

NOT_FOUND - Message: Resource not found - Cause: The requested

resource doesn’t exist - Common Cases: Invalid order ID, invalid reference, deleted resource - Action: - Verify the ID/reference is correct
  • Check for typos - Handle gracefully in UI

RATE_LIMIT_EXCEEDED

  • Message: Too many requests
  • Cause: Exceeded the rate limit
  • Limits: Sandbox: 60 req/min, Production: 120 req/min
  • Action: Implement exponential backoff with retry logic

INTERNAL_SERVER_ERROR / INTERNAL_ERROR

  • Message: Developer was notified and will check shortly
  • Cause: Unexpected error on our servers
  • Action:
    • Don’t refund immediately - wait 24 hours
    • Save requestId for support
    • Implement retry logic with backoff
    • Contact support with details
    • We’re automatically notified

ERR_SERVICE

  • Message: Service temporarily unavailable
  • Cause: Service maintenance or temporary issue
  • Action:
    • Show maintenance message
    • Retry after delay
    • Monitor for resolution

Implementation Best Practices

1. Always Check Success Field

2. Handle Specific Error Codes

3. Smart Retry Logic with Exponential Backoff

4. User-Friendly Error Messages

5. Log Request IDs

Advanced Patterns

Circuit Breaker Pattern

Prevent cascading failures by stopping requests when error rate is high:

Error Monitoring

Track error patterns to identify issues early:

Handling UNKNOWN_ERROR

Critical: Never refund immediately on UNKNOWN_ERROR. Always wait 24 hours for resolution.

Testing Error Scenarios

Use sandbox mode to test error handling:

Quick Reference

Validate Early

Validate input client-side before API calls to catch errors early

Retry Smart

Use exponential backoff for 5xx errors, never retry 4xx errors

Log Context

Always include requestId and context in logs for debugging

User Feedback

Show clear, actionable error messages to users

Bill Payment errors

This section covers the Bill Payment endpoints under https://api.oneclickdz.com/v3/bills. They add the codes below to the key-level errors described above, which apply here too.
Bill Payment returns the same envelope as every other service — success, error.code, error.message, requestId — and every response also carries an X-Request-Id header.

Synchronous errors

These are returned by the request itself. This is the complete set. AUTH_UNAVAILABLE carries a Retry-After: 5 header and nothing was started, so the same request can be sent again. PARTNER_UNAVAILABLE and SERVICE_UNAVAILABLE do not — back off on your side, and for SERVICE_UNAVAILABLE recover with GET /v3/bills/transactions/by-ref rather than resending.

Terminal errors

These never appear in a response body of their own. They appear inside a transaction’s error object, and only when its status is FAILED or REFUNDED. Branch on code, never on message.

Two rules that matter more than the rest

A foreign transaction is a 404, not a 403. A transaction that belongs to another partner — or to the other environment — is reported as not found, by design, so the API never confirms that someone else’s transaction exists. Treat 404 as “check the identifier and the key”, not as “access denied”.
UNKNOWN is not an error. It is a status meaning the outcome has not been confirmed yet, and it resolves on its own to SUCCESS or REFUNDED. While it lasts: never refund your customer, never resend the payment, and never show “payment failed”. Keep polling.

Where to go next

Bill Payment Overview

How the whole flow fits together

Status Polling

Handling UNKNOWN and REFUNDED

Get Transaction by ID

The transaction object and its statuses

Sandbox Testing

Reproduce each error on demand

Next Steps

Core Endpoints

Explore all endpoints

Response Format

Understanding API responses