# api\_errors

From **Stripe API**.

- Type: `object`

## Properties

### `charge`

- Required: false
- Type: `string`
- maxLength: `5000`

For card errors, the ID of the failed charge.

### `code`

- Required: false
- Type: `string`
- maxLength: `5000`

For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported.

### `decline_code`

- Required: false
- Type: `string`
- maxLength: `5000`

For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one.

### `doc_url`

- Required: false
- Type: `string`
- maxLength: `5000`

A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported.

### `message`

- Required: false
- Type: `string`
- maxLength: `40000`

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

### `param`

- Required: false
- Type: `string`
- maxLength: `5000`

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.

### `payment_intent`

- Required: false
- Type: `object`

A PaymentIntent guides you through the process of collecting a payment from your customer.
We recommend that you create exactly one PaymentIntent for each order or
customer session in your system. You can reference the PaymentIntent later to
see the history of payment attempts for a particular session.

A PaymentIntent transitions through
[multiple statuses](https://stripe.com/docs/payments/intents#intent-statuses)
throughout its lifetime as it interfaces with Stripe.js to perform
authentication flows and ultimately creates at most one successful charge.

Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents).

### `payment_method`

- Required: false
- Type: `object`

PaymentMethod objects represent your customer's payment instruments.
They can be used with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or saved to
Customer objects to store instrument details for future payments.

Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).

### `payment_method_type`

- Required: false
- Type: `string`
- maxLength: `5000`

If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.

### `setup_intent`

- Required: false
- Type: `object`

A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments.
For example, you could use a SetupIntent to set up and save your customer's card without immediately collecting a payment.
Later, you can use [PaymentIntents](https://stripe.com/docs/api#payment_intents) to drive the payment flow.

Create a SetupIntent as soon as you're ready to collect your customer's payment credentials.
Do not maintain long-lived, unconfirmed SetupIntents as they may no longer be valid.
The SetupIntent then transitions through multiple [statuses](https://stripe.com/docs/payments/intents#intent-statuses) as it guides
you through the setup process.

Successful SetupIntents result in payment credentials that are optimized for future payments.
For example, cardholders in [certain regions](/guides/strong-customer-authentication) may need to be run through
[Strong Customer Authentication](https://stripe.com/docs/strong-customer-authentication) at the time of payment method collection
in order to streamline later [off-session payments](https://stripe.com/docs/payments/setup-intents).
If the SetupIntent is used with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer), upon success,
it will automatically attach the resulting payment method to that Customer.
We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on
PaymentIntents to save payment methods in order to prevent saving invalid or unoptimized payment methods.

By using SetupIntents, you ensure that your customers experience the minimum set of required friction,
even as regulations change over time.

Related guide: [Setup Intents API](https://stripe.com/docs/payments/setup-intents).

### `source`

- Required: false
The source object for errors returned on a request involving a source.

### `type`

- Required: true
- Type: `string`
- Allowed values: `"api_error"`, `"card_error"`, `"idempotency_error"`, `"invalid_request_error"`

The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error`

## JSON Schema

```json
{"properties":{"charge":{"description":"For card errors, the ID of the failed charge.","maxLength":5000,"type":"string"},"code":{"description":"For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported.","maxLength":5000,"type":"string"},"decline_code":{"description":"For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one.","maxLength":5000,"type":"string"},"doc_url":{"description":"A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported.","maxLength":5000,"type":"string"},"message":{"description":"A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.","maxLength":40000,"type":"string"},"param":{"description":"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.","maxLength":5000,"type":"string"},"payment_intent":{"$ref":"#/components/schemas/payment_intent"},"payment_method":{"$ref":"#/components/schemas/payment_method"},"payment_method_type":{"description":"If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.","maxLength":5000,"type":"string"},"setup_intent":{"$ref":"#/components/schemas/setup_intent"},"source":{"anyOf":[{"$ref":"#/components/schemas/bank_account"},{"$ref":"#/components/schemas/card"},{"$ref":"#/components/schemas/source"}],"description":"The source object for errors returned on a request involving a source."},"type":{"description":"The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error`","enum":["api_error","card_error","idempotency_error","invalid_request_error"],"type":"string"}},"required":["type"],"title":"APIErrors","type":"object","x-expandableFields":["payment_intent","payment_method","setup_intent","source"]}
```
