Error Handling
All Wava API errors return a consistent JSON structure:Error fields
Validation error example
When validation fails (code2000 or 4005), the response includes an array of field-specific errors:
Gateway error example
When a payment gateway returns an error, the response includes the gateway name:HTTP status codes
Best practices
- Always check the HTTP status code first.
- Use
api_codefor programmatic error handling (notmessage, which may change or be localized). - For
400errors, check thevalidation_errorsarray for field-specific issues. - For
500and503errors, retry with exponential backoff. - For gateway errors (6000+), check
gateway_nameto determine which gateway returned the error and handle accordingly.