Stripe.Resources.SetupIntent (tiger_stripe v0.3.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

automatic_payment_methods()

@type automatic_payment_methods() :: %{
  optional(:allow_redirects) => String.t() | nil,
  optional(:enabled) => boolean() | nil,
  optional(String.t()) => term()
}
  • allow_redirects - Controls whether this SetupIntent will accept redirect-based payment methods.

Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps. To confirm this SetupIntent, you may be required to provide a return_url to redirect customers back to your site after they authenticate or complete the setup. Possible values: always, never.

  • enabled - Automatically calculates compatible payment methods Nullable.

next_action()

@type next_action() :: %{
  optional(:cashapp_handle_redirect_or_display_qr_code) =>
    Stripe.Resources.CashappHandleRedirectOrDisplayQrCode.t() | nil,
  optional(:redirect_to_url) =>
    Stripe.Resources.NextActionRedirectToUrl.t() | nil,
  optional(:type) => String.t() | nil,
  optional(:use_stripe_sdk) => map() | nil,
  optional(:verify_with_microdeposits) =>
    next_action_verify_with_microdeposits() | nil,
  optional(String.t()) => term()
}
  • cashapp_handle_redirect_or_display_qr_code
  • redirect_to_url
  • type - Type of the next action to perform. Refer to the other child attributes under next_action for available values. Examples include: redirect_to_url, use_stripe_sdk, alipay_handle_redirect, oxxo_display_details, or verify_with_microdeposits. Max length: 5000.
  • use_stripe_sdk - When confirming a SetupIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js.
  • verify_with_microdeposits

next_action_verify_with_microdeposits()

@type next_action_verify_with_microdeposits() :: %{
  optional(:arrival_date) => integer() | nil,
  optional(:hosted_verification_url) => String.t() | nil,
  optional(:microdeposit_type) => String.t() | nil,
  optional(String.t()) => term()
}
  • arrival_date - The timestamp when the microdeposits are expected to land. Format: Unix timestamp.
  • hosted_verification_url - The URL for the hosted verification page, which allows customers to verify their bank account. Max length: 5000.
  • microdeposit_type - The type of the microdeposit sent to the customer. Used to distinguish between different verification methods. Possible values: amounts, descriptor_code. Nullable.

payment_method_configuration_details()

@type payment_method_configuration_details() :: %{
  optional(:id) => String.t() | nil,
  optional(:parent) => String.t() | nil,
  optional(String.t()) => term()
}
  • id - ID of the payment method configuration used. Max length: 5000.
  • parent - ID of the parent payment method configuration used. Max length: 5000. Nullable.

payment_method_options()

@type payment_method_options() :: %{
  optional(:acss_debit) => payment_method_options_acss_debit() | nil,
  optional(:amazon_pay) => map() | nil,
  optional(:bacs_debit) => payment_method_options_bacs_debit() | nil,
  optional(:card) => payment_method_options_card() | nil,
  optional(:card_present) => map() | nil,
  optional(:klarna) => payment_method_options_klarna() | nil,
  optional(:link) => payment_method_options_link() | nil,
  optional(:paypal) => payment_method_options_paypal() | nil,
  optional(:payto) => payment_method_options_payto() | nil,
  optional(:sepa_debit) => payment_method_options_sepa_debit() | nil,
  optional(:us_bank_account) => payment_method_options_us_bank_account() | nil,
  optional(String.t()) => term()
}
  • acss_debit
  • amazon_pay
  • bacs_debit
  • card
  • card_present
  • klarna
  • link
  • paypal
  • payto
  • sepa_debit
  • us_bank_account

payment_method_options_acss_debit()

@type payment_method_options_acss_debit() :: %{
  optional(:currency) => String.t() | nil,
  optional(:mandate_options) =>
    payment_method_options_acss_debit_mandate_options() | nil,
  optional(:verification_method) => String.t() | nil,
  optional(String.t()) => term()
}
  • currency - Currency supported by the bank account Possible values: cad, usd. Nullable.
  • mandate_options
  • verification_method - Bank account verification method. Possible values: automatic, instant, microdeposits.

payment_method_options_acss_debit_mandate_options()

@type payment_method_options_acss_debit_mandate_options() :: %{
  optional(:custom_mandate_url) => String.t() | nil,
  optional(:default_for) => [String.t()] | nil,
  optional(:interval_description) => String.t() | nil,
  optional(:payment_schedule) => String.t() | nil,
  optional(:transaction_type) => String.t() | nil,
  optional(String.t()) => term()
}
  • custom_mandate_url - A URL for custom mandate text Max length: 5000.
  • default_for - List of Stripe products where this mandate can be selected automatically.
  • interval_description - Description of the interval. Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. Max length: 5000. Nullable.
  • payment_schedule - Payment schedule for the mandate. Possible values: combined, interval, sporadic. Nullable.
  • transaction_type - Transaction type of the mandate. Possible values: business, personal. Nullable.

payment_method_options_bacs_debit()

@type payment_method_options_bacs_debit() :: %{
  optional(:mandate_options) =>
    Stripe.Resources.BacsDebitMandateOptions.t() | nil,
  optional(String.t()) => term()
}
  • mandate_options

payment_method_options_card()

@type payment_method_options_card() :: %{
  optional(:mandate_options) => Stripe.Resources.MandateOptions.t() | nil,
  optional(:network) => String.t() | nil,
  optional(:request_three_d_secure) => String.t() | nil,
  optional(String.t()) => term()
}
  • mandate_options - Configuration options for setting up an eMandate for cards issued in India. Nullable.
  • network - Selected network to process this SetupIntent on. Depends on the available networks of the card attached to the setup intent. Can be only set confirm-time. Possible values: amex, cartes_bancaires, diners, discover, eftpos_au, girocard, interac, jcb, link, mastercard, unionpay, unknown, visa. Nullable.
  • request_three_d_secure - We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and other requirements. However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. If not provided, this value defaults to automatic. Read our guide on manually requesting 3D Secure for more information on how this configuration interacts with Radar and our SCA Engine. Possible values: any, automatic, challenge. Nullable.

payment_method_options_klarna()

@type payment_method_options_klarna() :: %{
  optional(:currency) => String.t() | nil,
  optional(:preferred_locale) => String.t() | nil,
  optional(String.t()) => term()
}
  • currency - The currency of the setup intent. Three letter ISO currency code. Format: ISO 4217 currency code. Nullable.
  • preferred_locale - Preferred locale of the Klarna checkout page that the customer is redirected to. Max length: 5000. Nullable.

payment_method_options_link()

@type payment_method_options_link() :: %{
  optional(:persistent_token) => String.t() | nil,
  optional(String.t()) => term()
}
  • persistent_token - [Deprecated] This is a legacy parameter that no longer has any function. Max length: 5000. Nullable.

payment_method_options_paypal()

@type payment_method_options_paypal() :: %{
  optional(:billing_agreement_id) => String.t() | nil,
  optional(String.t()) => term()
}
  • billing_agreement_id - The PayPal Billing Agreement ID (BAID). This is an ID generated by PayPal which represents the mandate between the merchant and the customer. Max length: 5000. Nullable.

payment_method_options_payto()

@type payment_method_options_payto() :: %{
  optional(:mandate_options) =>
    payment_method_options_payto_mandate_options() | nil,
  optional(String.t()) => term()
}
  • mandate_options

payment_method_options_payto_mandate_options()

@type payment_method_options_payto_mandate_options() :: %{
  optional(:amount) => integer() | nil,
  optional(:amount_type) => String.t() | nil,
  optional(:end_date) => String.t() | nil,
  optional(:payment_schedule) => String.t() | nil,
  optional(:payments_per_period) => integer() | nil,
  optional(:purpose) => String.t() | nil,
  optional(:start_date) => String.t() | nil,
  optional(String.t()) => term()
}
  • amount - Amount that will be collected. It is required when amount_type is fixed. Nullable.
  • amount_type - The type of amount that will be collected. The amount charged must be exact or up to the value of amount param for fixed or maximum type respectively. Defaults to maximum. Possible values: fixed, maximum. Nullable.
  • end_date - Date, in YYYY-MM-DD format, after which payments will not be collected. Defaults to no end date. Max length: 5000. Nullable.
  • payment_schedule - The periodicity at which payments will be collected. Defaults to adhoc. Possible values: adhoc, annual, daily, fortnightly, monthly, quarterly, semi_annual, weekly. Nullable.
  • payments_per_period - The number of payments that will be made during a payment period. Defaults to 1 except for when payment_schedule is adhoc. In that case, it defaults to no limit. Nullable.
  • purpose - The purpose for which payments are made. Has a default value based on your merchant category code. Possible values: dependant_support, government, loan, mortgage, other, pension, personal, retail, salary, tax, utility. Nullable.
  • start_date - Date, in YYYY-MM-DD format, from which payments will be collected. Defaults to confirmation time. Max length: 5000. Nullable.

payment_method_options_sepa_debit()

@type payment_method_options_sepa_debit() :: %{
  optional(:mandate_options) =>
    Stripe.Resources.SepaDebitMandateOptions.t() | nil,
  optional(String.t()) => term()
}
  • mandate_options

payment_method_options_us_bank_account()

@type payment_method_options_us_bank_account() :: %{
  optional(:financial_connections) =>
    payment_method_options_us_bank_account_financial_connections() | nil,
  optional(:mandate_options) =>
    payment_method_options_us_bank_account_mandate_options() | nil,
  optional(:verification_method) => String.t() | nil,
  optional(String.t()) => term()
}
  • financial_connections
  • mandate_options
  • verification_method - Bank account verification method. Possible values: automatic, instant, microdeposits.

payment_method_options_us_bank_account_financial_connections()

@type payment_method_options_us_bank_account_financial_connections() :: %{
  optional(:filters) =>
    payment_method_options_us_bank_account_financial_connections_filters() | nil,
  optional(:permissions) => [String.t()] | nil,
  optional(:prefetch) => [String.t()] | nil,
  optional(:return_url) => String.t() | nil,
  optional(String.t()) => term()
}
  • filters
  • permissions - The list of permissions to request. The payment_method permission must be included.
  • prefetch - Data features requested to be retrieved upon account creation. Nullable.
  • return_url - For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. Max length: 5000.

payment_method_options_us_bank_account_financial_connections_filters()

@type payment_method_options_us_bank_account_financial_connections_filters() :: %{
  optional(:account_subcategories) => [String.t()] | nil,
  optional(String.t()) => term()
}
  • account_subcategories - The account subcategories to use to filter for possible accounts to link. Valid subcategories are checking and savings.

payment_method_options_us_bank_account_mandate_options()

@type payment_method_options_us_bank_account_mandate_options() :: %{
  optional(:collection_method) => String.t() | nil,
  optional(String.t()) => term()
}
  • collection_method - Mandate collection method Possible values: paper.

t()

@type t() :: %Stripe.Resources.SetupIntent{
  application: String.t() | Stripe.Resources.Application.t(),
  attach_to_self: boolean() | nil,
  automatic_payment_methods: automatic_payment_methods(),
  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()) => String.t()},
  next_action: next_action(),
  object: String.t(),
  on_behalf_of: String.t() | Stripe.Resources.Account.t(),
  payment_method: String.t() | Stripe.Resources.PaymentMethod.t(),
  payment_method_configuration_details: payment_method_configuration_details(),
  payment_method_options: payment_method_options(),
  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 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()