Skip to main content

Handling Errors

Modem Pay returns errors in a consistent JSON format to make it easy to handle issues in your application. Each error includes a simple message explaining the issue, with HTTP status codes indicating the type of error.

Error Format

All error responses follow this structure:

{
"message": "Description of the error"
}

Common Status Codes

  • 4xx Client Errors: These indicate issues in the request sent to the server.

    • 400 Bad Request: The request was invalid or missing required fields.
    • 401 Unauthorized: Missing or invalid API key.
    • 403 Forbidden: You don't have permission to access this resource.
    • 404 Not Found: The requested resource doesn't exist or was entered incorrectly.
    • 405 Method Not Allowed: The HTTP method used is not supported for this endpoint.
    • 422 Unprocessable Entity: The request was well-formed but contained semantic errors.
  • 5xx Server Errors: These signify an issue on Modem Pay’s end.

    • 500 Internal Server Error: General server error; retry the request or contact support if it persists.

Handling Errors

Check the message field in the response to understand the cause of the error. If the status code is 400 or higher, review your request parameters and API key to ensure they meet Modem Pay's requirements.