Search documentation of stripe_elixir

# StripeElixir.Resources.SetupIntent (stripe_elixir v0.1.0)

Copy Markdown View Source

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 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 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 might need to be run through Strong Customer Authentication during payment method collection to streamline later off-session payments. If you use the SetupIntent with a Customer, it automatically attaches the resulting payment method to that Customer after successful setup. We recommend using SetupIntents or 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

## Summary

### Types

t()

### Functions

expandable_fields()
object_name()

## Types

# t()

    @type t() :: %StripeElixir.Resources.SetupIntent{
      application: String.t() | map(),
      attach_to_self: boolean() | nil,
      automatic_payment_methods: map(),
      cancellation_reason: String.t(),
      client_secret: String.t(),
      created: integer(),
      customer: map(),
      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: String.t() | map(),
      latest_attempt: String.t() | map(),
      livemode: boolean(),
      mandate: String.t() | map(),
      metadata: map(),
      next_action: map(),
      object: String.t(),
      on_behalf_of: String.t() | map(),
      payment_method: String.t() | map(),
      payment_method_configuration_details: map(),
      payment_method_options: map(),
      payment_method_types: [String.t()],
      single_use_mandate: String.t() | map(),
      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 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 associated with the `latest_attempt` is attached to the Customer instead. Nullable. Expandable.
- `payment_method_configuration_details` - Information about the payment method configuration 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.
- `single_use_mandate` - ID of the single_use Mandate generated by the SetupIntent. Nullable. Expandable.
- `status` - Status 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.

## Functions

# expandable_fields()

# object_name()