Skip to main content
A failed request returns a 4xx or 5xx status and a JSON body with success set to false. The response field holds a short message.

Status codes

Messages

Validation messages name the field that was rejected, such as Invalid currency, Invalid amount or Invalid expires_at. Each endpoint in this reference lists the messages it can return. Other messages describe a rule that was broken: Messages are written for people. Base your code on the HTTP status and on success, not on the exact text.

Request bodies that are not JSON

A request body that is not valid JSON, or that is sent without Content-Type: application/json, is rejected before it reaches the endpoint. That response has a 4xx status and a plain text body instead of the JSON shown above.

Handling failures

  • 400, 401, 403, 404: fix the request. Sending the same request again returns the same error.
  • 500 and timeouts: wait a moment and try again.
Creating a checkout twice makes two checkouts. If a create request times out, list checkouts by the reference you sent before trying again, in case the first request went through.