Error Response Format
All errors follow the RFC 7807 Problem Details specification:HTTP Status Codes
Request successful
Resource created successfully
Invalid request parameters or malformed request body
Missing or invalid authentication credentials
Requested resource not found
Request validation failed or business logic error
Common Error Scenarios
Authentication Errors
- Missing
Authorizationheader - Invalid API key
- Expired token
Validation Errors
- Invalid field values
- Missing required fields
- Format constraints not met
Not Found Errors
- Invalid transaction reference
- Resource doesn’t exist
- Unauthorized access to resource
Payment-Specific Errors
Insufficient Balance
Invalid Mobile Number
Transaction Already Refunded
Best Practices
- Always check the status code first to determine the error type
- Log the complete error response for debugging
- Parse the
detailfield for user-friendly error messages - Implement retry logic for transient errors (5xx status codes)
- Handle validation errors by displaying specific field errors to users