Error Codes Reference
Complete guide to API error codes and solutions
INVALID_API_KEYInvalid API key provided
The API key provided is invalid or has been revoked
Solution
Check your API key is correct and active in your dashboard
Example Response
{
"success": false,
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API key provided",
"details": {}
},
"request_id": "req_abc123xyz789"
}API_KEY_EXPIREDAPI key has expired
Your API key has expired and needs to be regenerated
Solution
Generate a new API key from your dashboard
Example Response
{
"success": false,
"error": {
"code": "API_KEY_EXPIRED",
"message": "API key has expired",
"details": {}
},
"request_id": "req_abc123xyz789"
}UNAUTHORIZEDNot authorized to access this resource
Your API key does not have permission to access this resource
Solution
Check API key permissions or contact support
Example Response
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Not authorized to access this resource",
"details": {}
},
"request_id": "req_abc123xyz789"
}INVALID_SIGNATURERequest signature verification failed
The HMAC signature provided does not match the expected signature
Solution
Verify your signature generation logic matches the documentation
Example Response
{
"success": false,
"error": {
"code": "INVALID_SIGNATURE",
"message": "Request signature verification failed",
"details": {}
},
"request_id": "req_abc123xyz789"
}VALIDATION_ERRORRequest validation failed
One or more required fields are missing or invalid
Solution
Check request body against API specification
Example Response
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": {}
},
"request_id": "req_abc123xyz789"
}INVALID_PHONE_NUMBERInvalid phone number format
Phone number must be in E.164 format
Solution
Use format: +260977123456 for Zambian numbers
Example Response
{
"success": false,
"error": {
"code": "INVALID_PHONE_NUMBER",
"message": "Invalid phone number format",
"details": {}
},
"request_id": "req_abc123xyz789"
}INVALID_AMOUNTAmount must be positive
Payment amount must be greater than zero
Solution
Ensure amount > 0 and meets minimum requirements
Example Response
{
"success": false,
"error": {
"code": "INVALID_AMOUNT",
"message": "Amount must be positive",
"details": {}
},
"request_id": "req_abc123xyz789"
}INVALID_CURRENCYUnsupported currency
The currency code provided is not supported
Solution
Use supported currencies: ZMW, USD, EUR, GBP
Example Response
{
"success": false,
"error": {
"code": "INVALID_CURRENCY",
"message": "Unsupported currency",
"details": {}
},
"request_id": "req_abc123xyz789"
}INVALID_PAYMENT_METHODPayment method not supported
The payment method specified is not available
Solution
Use: mobile_money, card, or bank_transfer
Example Response
{
"success": false,
"error": {
"code": "INVALID_PAYMENT_METHOD",
"message": "Payment method not supported",
"details": {}
},
"request_id": "req_abc123xyz789"
}INSUFFICIENT_FUNDSRetryableInsufficient funds in account
Customer does not have enough balance to complete payment
Solution
Customer needs to add funds to their account
Example Response
{
"success": false,
"error": {
"code": "INSUFFICIENT_FUNDS",
"message": "Insufficient funds in account",
"details": {}
},
"request_id": "req_abc123xyz789"
}PAYMENT_DECLINEDRetryablePayment declined by provider
The payment provider declined the transaction
Solution
Try different payment method or contact provider
Example Response
{
"success": false,
"error": {
"code": "PAYMENT_DECLINED",
"message": "Payment declined by provider",
"details": {}
},
"request_id": "req_abc123xyz789"
}PAYMENT_EXPIREDPayment session expired
The payment session has timed out
Solution
Create a new payment transaction
Example Response
{
"success": false,
"error": {
"code": "PAYMENT_EXPIRED",
"message": "Payment session expired",
"details": {}
},
"request_id": "req_abc123xyz789"
}DUPLICATE_TRANSACTIONDuplicate transaction detected
A transaction with this idempotency key already exists
Solution
Check idempotency key or retrieve existing transaction
Example Response
{
"success": false,
"error": {
"code": "DUPLICATE_TRANSACTION",
"message": "Duplicate transaction detected",
"details": {}
},
"request_id": "req_abc123xyz789"
}AMOUNT_TOO_HIGHAmount exceeds limit
Transaction amount exceeds maximum allowed
Solution
Reduce amount or split into multiple payments
Example Response
{
"success": false,
"error": {
"code": "AMOUNT_TOO_HIGH",
"message": "Amount exceeds limit",
"details": {}
},
"request_id": "req_abc123xyz789"
}CARD_DECLINEDRetryableCard declined
The card was declined by the issuing bank
Solution
Try different card or contact card issuer
Example Response
{
"success": false,
"error": {
"code": "CARD_DECLINED",
"message": "Card declined",
"details": {}
},
"request_id": "req_abc123xyz789"
}PROVIDER_TIMEOUTRetryableProvider timeout
Payment provider did not respond in time
Solution
Retry after a few minutes
Example Response
{
"success": false,
"error": {
"code": "PROVIDER_TIMEOUT",
"message": "Provider timeout",
"details": {}
},
"request_id": "req_abc123xyz789"
}TRANSACTION_NOT_FOUNDTransaction not found
No transaction exists with the provided ID
Solution
Check transaction ID is correct
Example Response
{
"success": false,
"error": {
"code": "TRANSACTION_NOT_FOUND",
"message": "Transaction not found",
"details": {}
},
"request_id": "req_abc123xyz789"
}MERCHANT_NOT_FOUNDMerchant not found
No merchant account exists with the provided ID
Solution
Verify merchant ID
Example Response
{
"success": false,
"error": {
"code": "MERCHANT_NOT_FOUND",
"message": "Merchant not found",
"details": {}
},
"request_id": "req_abc123xyz789"
}CUSTOMER_NOT_FOUNDCustomer not found
No customer exists with the provided ID
Solution
Check customer ID or create new customer
Example Response
{
"success": false,
"error": {
"code": "CUSTOMER_NOT_FOUND",
"message": "Customer not found",
"details": {}
},
"request_id": "req_abc123xyz789"
}RATE_LIMIT_EXCEEDEDRetryableToo many requests
You have exceeded the rate limit for this endpoint
Solution
Slow down requests and implement exponential backoff
Example Response
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests",
"details": {}
},
"request_id": "req_abc123xyz789"
}CONCURRENT_LIMIT_EXCEEDEDRetryableToo many concurrent requests
Too many requests are being processed simultaneously
Solution
Reduce parallelism in your application
Example Response
{
"success": false,
"error": {
"code": "CONCURRENT_LIMIT_EXCEEDED",
"message": "Too many concurrent requests",
"details": {}
},
"request_id": "req_abc123xyz789"
}INTERNAL_ERRORRetryableInternal server error
An unexpected error occurred on our servers
Solution
Retry with exponential backoff or contact support
Example Response
{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "Internal server error",
"details": {}
},
"request_id": "req_abc123xyz789"
}SERVICE_UNAVAILABLERetryableService temporarily unavailable
The service is temporarily down for maintenance
Solution
Retry after delay indicated in Retry-After header
Example Response
{
"success": false,
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "Service temporarily unavailable",
"details": {}
},
"request_id": "req_abc123xyz789"
}PROVIDER_UNAVAILABLERetryablePayment provider unavailable
The payment provider is temporarily unavailable
Solution
Use fallback provider or retry later
Example Response
{
"success": false,
"error": {
"code": "PROVIDER_UNAVAILABLE",
"message": "Payment provider unavailable",
"details": {}
},
"request_id": "req_abc123xyz789"
}Error Handling Best Practices
Always Check Status Codes
Use HTTP status codes to determine error type before parsing response
Implement Retry Logic
Use exponential backoff for retryable errors (5xx, 429)
Log Error Details
Include request_id in logs for easier debugging and support
Handle Idempotency
Use idempotency keys to safely retry failed requests