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,




type string

The 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 string

For some errors that could be handled programmatically, a short string indicating the error code reported

message string

A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.

trace_id string

A trace id you can reference when debugging the error

param string, optional

If 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, optional

For card errors resulting from a card issuer decline, a short string indicating the card issuer’s reason for the decline if they provide one.