Element uses HTTP response codes to indicate the status of an API request. In general, 2xx codes indicate success. 4xx codes indicate an error that the request failed, with a detailed reason in the message (eg. missing required parameter, invalid card expiration). 5xx codes indicate an error within Elements servers (these are rare).

{
  "type": "card_error",
  "code": "account_already_exists",
  "message": "Customer account has been created before.",
  "trace_id": "SJIWnjkrnqkjioJIONSKAODLJ",
  "param": null,
  "decline_code": null,
}

Attributes

AttributeDescription
type stringThe type of error returned. One of api_connection_error, api_error, authentication_error, card_error, idempotency_error, invalid_request_error, or rate_limit_error
code stringFor some errors that could be handled programmatically, a short string indicating the error code reported
message stringA human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
trace_id stringA trace id you can reference when debugging the error
param string, optionalIf the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
decline_code string, optionalFor card errors resulting from a card issuer decline, a short string indicating the card issuer’s reason for the decline if they provide one.