Error Handling

The Teljoy Platform Payment API uses standard HTTP status codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the provided information (e.g., a required parameter was missing), and codes in the 5xx range indicate a server-side error.

When an error occurs, the API will return a JSON object containing more information about the error. This object will have the following structure:

{
  "type": "string",
  "title": "string",
  "status": "integer",
  "detail": "string",
  "instance": "string",
  "errors": {
    "field1": ["Error message 1"],
    "field2": ["Error message 2"]
  }
}
FieldTypeDescription
typestringA URI reference that identifies the problem type
titlestringA short, human-readable summary of the problem
statusintegerThe HTTP status code generated by the origin server for this occurrence
detailstringA human-readable explanation specific to this occurrence of the problem
instancestringA URI reference that identifies the specific occurrence of the problem
errorsobjectAn object containing field-specific error messages (only for 4xx errors)

Common Error Codes

Here are some common error codes you might encounter while using the Payment API:

CodeDescription
400Bad Request - The request was invalid or cannot be served. The exact error should be explained in the error payload.
401Unauthorized - The request requires authentication. The API key is missing or invalid.
403Forbidden - The client does not have access rights to the content.
404Not Found - The requested resource could not be found.
500Internal Server Error - The server failed to fulfill a valid request.

When handling errors, it's important to check the error payload for more information and to handle different error codes appropriately in your application.

Last Updated:
Contributors: rzimanTJY