# `Stripe.Resources.SetupIntent`
[🔗](https://github.com/jeffhuen/tiger_stripe/blob/main/lib/stripe/resources/setup_intent.ex#L2)

SetupIntent

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

Create a SetupIntent when you're ready to collect your customer's payment credentials.
Don't maintain long-lived, unconfirmed SetupIntents because they might not be valid.
The SetupIntent transitions through multiple [statuses](https://docs.stripe.com/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](https://stripe.com/guides/strong-customer-authentication) might need to be run through
[Strong Customer Authentication](https://docs.stripe.com/strong-customer-authentication) during payment method collection
to streamline later [off-session payments](https://docs.stripe.com/payments/setup-intents).
If you use the SetupIntent with a [Customer](https://api.stripe.com#setup_intent_object-customer),
it automatically attaches the resulting payment method to that Customer after successful setup.
We recommend using SetupIntents or [setup_future_usage](https://api.stripe.com#payment_intent_object-setup_future_usage) on
PaymentIntents to save payment methods to prevent saving invalid or unoptimized payment methods.

By using SetupIntents, you can reduce friction for your customers, even as regulations change over time.

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

# `t`

```elixir
@type t() :: %Stripe.Resources.SetupIntent{
  application: String.t() | Stripe.Resources.Application.t(),
  attach_to_self: boolean() | nil,
  automatic_payment_methods:
    Stripe.Resources.SetupIntent.AutomaticPaymentMethods.t(),
  cancellation_reason: String.t(),
  client_secret: String.t(),
  created: integer(),
  customer: String.t() | Stripe.Resources.Customer.t(),
  customer_account: String.t() | nil,
  description: String.t(),
  excluded_payment_method_types: [String.t()],
  flow_directions: [String.t()] | nil,
  id: String.t(),
  last_setup_error: Stripe.Resources.StripeError.t(),
  latest_attempt: String.t() | Stripe.Resources.SetupAttempt.t(),
  livemode: boolean(),
  mandate: String.t() | Stripe.Resources.Mandate.t(),
  metadata: %{required(String.t()) =&gt; String.t()},
  next_action: Stripe.Resources.SetupIntent.NextAction.t(),
  object: String.t(),
  on_behalf_of: String.t() | Stripe.Resources.Account.t(),
  payment_method: String.t() | Stripe.Resources.PaymentMethod.t(),
  payment_method_configuration_details:
    Stripe.Resources.SetupIntent.PaymentMethodConfigurationDetails.t(),
  payment_method_options: Stripe.Resources.SetupIntent.PaymentMethodOptions.t(),
  payment_method_types: [String.t()],
  single_use_mandate: String.t() | Stripe.Resources.Mandate.t(),
  status: String.t(),
  usage: String.t()
}
```

* `application` - ID of the Connect application that created the SetupIntent. Nullable. Expandable.
* `attach_to_self` - If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.

It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.
* `automatic_payment_methods` - Settings for dynamic payment methods compatible with this Setup Intent Nullable. Expandable.
* `cancellation_reason` - Reason for cancellation of this SetupIntent, one of `abandoned`, `requested_by_customer`, or `duplicate`. Possible values: `abandoned`, `duplicate`, `requested_by_customer`. Nullable.
* `client_secret` - The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.

The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret. Max length: 5000. Nullable.
* `created` - Time at which the object was created. Measured in seconds since the Unix epoch. Format: Unix timestamp.
* `customer` - ID of the Customer this SetupIntent belongs to, if one exists.

If present, the SetupIntent's payment method will be attached to the Customer on successful setup. Payment methods attached to other Customers cannot be used with this SetupIntent. Nullable. Expandable.
* `customer_account` - ID of the Account this SetupIntent belongs to, if one exists.

If present, the SetupIntent's payment method will be attached to the Account on successful setup. Payment methods attached to other Accounts cannot be used with this SetupIntent. Max length: 5000. Nullable.
* `description` - An arbitrary string attached to the object. Often useful for displaying to users. Max length: 5000. Nullable.
* `excluded_payment_method_types` - Payment method types that are excluded from this SetupIntent. Nullable.
* `flow_directions` - Indicates the directions of money movement for which this payment method is intended to be used.

Include `inbound` if you intend to use the payment method as the origin to pull funds from. Include `outbound` if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes. Nullable.
* `id` - Unique identifier for the object. Max length: 5000.
* `last_setup_error` - The error encountered in the previous SetupIntent confirmation. Nullable. Expandable.
* `latest_attempt` - The most recent SetupAttempt for this SetupIntent. Nullable. Expandable.
* `livemode` - Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
* `mandate` - ID of the multi use Mandate generated by the SetupIntent. Nullable. Expandable.
* `metadata` - Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Nullable.
* `next_action` - If present, this property tells you what actions you need to take in order for your customer to continue payment setup. Nullable. Expandable.
* `object` - String representing the object's type. Objects of the same type share the same value. Possible values: `setup_intent`.
* `on_behalf_of` - The account (if any) for which the setup is intended. Nullable. Expandable.
* `payment_method` - ID of the payment method used with this SetupIntent. If the payment method is `card_present` and isn't a digital wallet, then the [generated_card](https://docs.stripe.com/api/setup_attempts/object#setup_attempt_object-payment_method_details-card_present-generated_card) associated with the `latest_attempt` is attached to the Customer instead. Nullable. Expandable.
* `payment_method_configuration_details` - Information about the [payment method configuration](https://docs.stripe.com/api/payment_method_configurations) used for this Setup Intent. Nullable. Expandable.
* `payment_method_options` - Payment method-specific configuration for this SetupIntent. Nullable. Expandable.
* `payment_method_types` - The list of payment method types (e.g. card) that this SetupIntent is allowed to set up. A list of valid payment method types can be found [here](https://docs.stripe.com/api/payment_methods/object#payment_method_object-type).
* `single_use_mandate` - ID of the single_use Mandate generated by the SetupIntent. Nullable. Expandable.
* `status` - [Status](https://docs.stripe.com/payments/intents#intent-statuses) of this SetupIntent, one of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `canceled`, or `succeeded`. Possible values: `canceled`, `processing`, `requires_action`, `requires_confirmation`, `requires_payment_method`, `succeeded`.
* `usage` - Indicates how the payment method is intended to be used in the future.

Use `on_session` if you intend to only reuse the payment method when the customer is in your checkout flow. Use `off_session` if your customer may or may not be in your checkout flow. If not provided, this value defaults to `off_session`. Max length: 5000.

# `expandable_fields`

# `object_name`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
