Comprehensive guide to handling errors for both Deposit and Withdraw APIs
The LivePay API uses standard HTTP status codes and provides detailed error messages for both Deposit and Withdraw endpoints.
Authentication, validation, and network errors are common to both APIs, while amount limits and balance checks differ.
{
"status": "success",
"message": "Transaction completed successfully",
"phone": "256702069536",
"payment_method": "mtnmomo",
"transaction_id": "TXN123456789",
"reference_id": "REF123456",
"amount": 5000,
"charge_amount": 50,
"new_balance": 14950
}
{
"status": "error",
"message": "Invalid phone number provided"
}
| Code | Status | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Transaction created successfully |
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Invalid or missing authentication |
| 405 | Method Not Allowed | Invalid HTTP method used |
Bearer token is invalid or expired
Authorization header missing or malformed
Public API key doesn't match user account
User has disabled API access
Phone field missing in request
Phone contains invalid characters
Phone not supported by networks
Reference ID already exists
Minimum deposit amount violation
Maximum deposit amount exceeded
Global deposit API status disabled
Minimum withdrawal amount violation
Maximum withdrawal amount exceeded
User balance too low for withdrawal
Global withdraw API status disabled
Verify status code before parsing response body
Read the message field for specific details
Use exponential backoff for network errors
Pre-validate phone, amount, and reference ID
Always validate phone numbers, amounts, and reference IDs before API calls
Use exponential backoff for network and server errors (5xx status codes)
Set up webhook endpoints to receive real-time transaction status updates