xPay uses standard HTTP response codes to indicate the success or failure of an API request. Codes in the 2xx range signify success. Codes in the 4xx range indicate client-side errors based on the information provided. Codes in the 5xx range indicate errors related to xPay’s servers.

Below is the list of HTTP status codes

CodeReasonPotential Root Cause
200Request is OKThe request was successfully received and processed.
400Bad RequestThere’s something wrong about the request. Potentially incorrect parameters, insufficient parameters, or an issue with authentication.
401UnauthorizedYou do not have access to the requested resource or your API keys are incorrect.
404Resource Not FoundYou’re likely hitting the wrong endpoint or the resource does not exist.
500Internal Server ErrorLikely a server-side issue on xPay’s side.

Most errors in xPay will include an error code that can be used to handle the issue programmatically, along with a description that explains the reported problem.

Attributes of the error object

Example error object:

HTTP Status Code: 500
{
  "errorCode": "internal_server_error",
  "errorDescription": "An unexpected error occurred on the server."
}
errorCode
string

A unique code representing the type of error that occurred. This code is used to identify specific issues and facilitate troubleshooting.

errorDescription
string

A detailed message explaining the error represented by the error code. This description provides additional context to help understand the cause of the error.

Error codes

Below is a list of error codes that xPay may return in the errorCode field, along with information on how to resolve them.

Error CodeDescription
internal_server_errorIndicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
bad_requestThe server cannot or will not process the request due to a client error (e.g., malformed request syntax).
resource_not_foundThe server can’t find the requested resource, which could mean the URL is incorrect or the resource has been removed.
unauthorizedThe request requires user authentication. If the request lacks valid authentication credentials, the server responds with this error.