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

Next Steps

Core Endpoints

Explore all endpoints

Response Format

Understanding API responses