Errors

The Cash App Afterpay API uses conventional HTTP status codes and returns error responses in JSON format.

HTTP status codes

HTTP Status CodesDescription
200-299The request was processed successfully.
400-499The request was not valid (e.g. a required parameter was missing).
500-599The request could not be processed for an unexpected reason.

Error fields

FieldTypeDescription
errorCodestringThe type of error returned. For example, invalid_object, unsupported_currency, or invalid_token.
errorIdstringA unique error ID.
messagestringA human-readable message which provides more details about the error. In most cases, these messages can be displayed to the customer.
httpStatusCodeintegerThe HTTP status code.

Example errors

GET requests

With the exception of Ping, which doesn’t require authentication, all GET endpoints can return the following errors:

HTTP statusError codeDescription
401 UnauthorizedunauthorizedInvalid merchant API credentials were passed in the Authorization header.
405 Method Not Allowedmethod_not_allowedThe request was made by a method other than GET, HEAD, or OPTIONS.
406 Not AcceptableerrorThe request included an Accept header for something other than application/json or */*.

POST / PUT requests

All PUT and POST endpoints can return any of the following errors:

HTTP statusError codeDescription
400 Bad Requestinvalid_jsonThe request body contains invalid or improperly formatted JSON.
401 UnauthorizedunauthorizedInvalid Merchant API credentials were passed in the Authorization header.
405 Method Not Allowedmethod_not_allowedThe request used an unsupported HTTP method. Only PUT or POST may be allowed, depending on the endpoint. Use OPTIONS to check.
406 Not AcceptableerrorThe Accept header was not set to application/json or */*.
415 Unsupported Media TypeerrorThe request lacked a Content-Type header or used a value other than application/json.
500 Internal Server ErrorerrorOften caused by a missing or empty request body in PUT or POST requests.