Comprehensive guide to handling errors for both Collection and Send Money APIs
The LivePay API uses standard HTTP status codes and provides detailed error messages for both Collection and Send Money endpoints.
Authentication and validation errors are common to both APIs, while currency activation, PIN validation, and balance checks differ.
{
"status": "success",
"message": "Collection initiated successfully",
"data": {
"reference": "52750by31220ffbc7de3b36",
"transaction_id": "67d4c8f3a1b29",
"amount": 500,
"currency": "UGX",
"network": "AIRTEL"
}
}
{
"status": "error",
"message": "Currency not supported"
}
| Code | Status | Description |
|---|---|---|
| 201 | Created | Transaction initiated successfully |
| 400 | Bad Request | Invalid request parameters, missing fields, unsupported currency, invalid network, insufficient balance |
| 401 | Unauthorized | Invalid API key, invalid public key, missing auth header, invalid PIN |
| 403 | Forbidden | KYC incomplete, API access off, IP restricted, currency not activated, PIN not set |
| 404 | Not Found | User not found |
| 405 | Method Not Allowed | Invalid HTTP method used (only POST allowed) |
| 409 | Conflict | Duplicate reference detected |
| 429 | Too Many Requests | Another transaction is currently processing (Send Money only) |
| 500 | Server Error | API error or system error |
Secret key not valid
Bearer token not provided or malformed
Public API key doesn't match user account
User has disabled API access
User account requires KYC verification
Required fields missing in request
Request body contains malformed JSON
Reference ID already exists
Only POST method is allowed
Currency code not recognized
Currency not activated for your account
Network not valid for selected currency
User account not found
Currency code not recognized
Currency not activated for your account
Network not valid for selected currency
User balance too low for withdrawal
Incorrect transaction PIN
PIN not set in user account
Concurrent transaction lock active
Error from payment provider
Error processing transaction
IP not whitelisted for API access
Malformed JSON in request body
Verify status code before parsing response body
Read the message field for specific details
Use exponential backoff for server errors (5xx status codes)
Pre-validate phone, amount, currency, and network
Always validate phone numbers, amounts, currency codes, and networks before API calls
Use exponential backoff for server errors (5xx status codes)
Set up webhook endpoints to receive real-time transaction status updates for collections