View Source Stripe.SetupIntent (Striped v0.5.0) (generated)

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 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 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 may need to be run through Strong Customer Authentication at the time of payment method collection in order to streamline later off-session payments. If the SetupIntent is used with a Customer, upon success, it will automatically attach the resulting payment method to that Customer. We recommend using SetupIntents or 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.

Link to this section Summary

Types

If this is a acss_debit SetupIntent, this sub-hash contains details about the ACSS Debit payment method options.

If this is an au_becs_debit PaymentMethod, this hash contains details about the bank account.

If this is a bacs_debit PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.

Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.

If this is a blik PaymentMethod, this hash contains details about the BLIK payment method.

If this is a boleto PaymentMethod, this hash contains details about the Boleto payment method.

Configuration for any card setup attempted on this SetupIntent.

This hash contains details about the customer acceptance of the Mandate.

Customer's date of birth

If this is an eps PaymentMethod, this hash contains details about the EPS payment method.

Additional fields for Financial Connections Session creation

If this is an fpx PaymentMethod, this hash contains details about the FPX payment method.

If this is an ideal PaymentMethod, this hash contains details about the iDEAL payment method.

If this is a klarna PaymentMethod, this hash contains details about the Klarna payment method.

If this is a link PaymentMethod, this sub-hash contains details about the Link payment method options.

This hash contains details about the Mandate to create. This parameter can only be used with confirm=true.

Additional fields for Mandate creation

Additional fields for network related functions

If this is a Mandate accepted online, this hash contains details about the online acceptance.

If this is a p24 PaymentMethod, this hash contains details about the P24 payment method.

When included, this hash creates a PaymentMethod that is set as the payment_method value in the SetupIntent.

Payment-method-specific configuration for this SetupIntent.

Options to configure Radar. See Radar Session for more information.

If this is a sepa_debit PaymentMethod, this hash contains details about the SEPA debit bank account.

If this hash is populated, this SetupIntent will generate a single_use Mandate on success.

If this is a sofort PaymentMethod, this hash contains details about the SOFORT payment method.

t()

The setup_intent type.

If this is a us_bank_account SetupIntent, this sub-hash contains details about the US bank account payment method options.

Functions

A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_confirmation, or requires_action..

Confirm that your customer intends to set up the current orprovided payment method. For example, you would confirm a SetupIntent when a customer hits the “Save” button on a payment method management page on your website.

Creates a SetupIntent object.

Returns a list of SetupIntents.

Retrieves the details of a SetupIntent that has previously been created..

Verifies microdeposits on a SetupIntent object.

Link to this section Types

@type acss_debit() :: %{
  optional(:currency) => :cad | :usd,
  optional(:mandate_options) => mandate_options(),
  optional(:verification_method) => :automatic | :instant | :microdeposits
}

If this is a acss_debit SetupIntent, this sub-hash contains details about the ACSS Debit payment method options.

@type address() :: %{
  optional(:city) => binary(),
  optional(:country) => binary(),
  optional(:line1) => binary(),
  optional(:line2) => binary(),
  optional(:postal_code) => binary(),
  optional(:state) => binary()
}
@type au_becs_debit() :: %{
  optional(:account_number) => binary(),
  optional(:bsb_number) => binary()
}

If this is an au_becs_debit PaymentMethod, this hash contains details about the bank account.

@type bacs_debit() :: %{
  optional(:account_number) => binary(),
  optional(:sort_code) => binary()
}

If this is a bacs_debit PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.

@type billing_details() :: %{
  optional(:address) => address() | binary(),
  optional(:email) => binary() | binary(),
  optional(:name) => binary(),
  optional(:phone) => binary()
}

Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.

@type blik() :: %{optional(:code) => binary()}

If this is a blik PaymentMethod, this hash contains details about the BLIK payment method.

@type boleto() :: %{optional(:tax_id) => binary()}

If this is a boleto PaymentMethod, this hash contains details about the Boleto payment method.

@type card() :: %{
  optional(:mandate_options) => mandate_options(),
  optional(:moto) => boolean(),
  optional(:network) =>
    :amex
    | :cartes_bancaires
    | :diners
    | :discover
    | :interac
    | :jcb
    | :mastercard
    | :unionpay
    | :unknown
    | :visa,
  optional(:request_three_d_secure) => :any | :automatic
}

Configuration for any card setup attempted on this SetupIntent.

@type created() :: %{
  optional(:gt) => integer(),
  optional(:gte) => integer(),
  optional(:lt) => integer(),
  optional(:lte) => integer()
}
@type customer_acceptance() :: %{
  optional(:accepted_at) => integer(),
  optional(:offline) => map(),
  optional(:online) => online(),
  optional(:type) => :offline | :online
}

This hash contains details about the customer acceptance of the Mandate.

@type dob() :: %{
  optional(:day) => integer(),
  optional(:month) => integer(),
  optional(:year) => integer()
}

Customer's date of birth

@type eps() :: %{
  optional(:bank) =>
    :arzte_und_apotheker_bank
    | :austrian_anadi_bank_ag
    | :bank_austria
    | :bankhaus_carl_spangler
    | :bankhaus_schelhammer_und_schattera_ag
    | :bawag_psk_ag
    | :bks_bank_ag
    | :brull_kallmus_bank_ag
    | :btv_vier_lander_bank
    | :capital_bank_grawe_gruppe_ag
    | :deutsche_bank_ag
    | :dolomitenbank
    | :easybank_ag
    | :erste_bank_und_sparkassen
    | :hypo_alpeadriabank_international_ag
    | :hypo_bank_burgenland_aktiengesellschaft
    | :hypo_noe_lb_fur_niederosterreich_u_wien
    | :hypo_oberosterreich_salzburg_steiermark
    | :hypo_tirol_bank_ag
    | :hypo_vorarlberg_bank_ag
    | :marchfelder_bank
    | :oberbank_ag
    | :raiffeisen_bankengruppe_osterreich
    | :schoellerbank_ag
    | :sparda_bank_wien
    | :volksbank_gruppe
    | :volkskreditbank_ag
    | :vr_bank_braunau
}

If this is an eps PaymentMethod, this hash contains details about the EPS payment method.

Link to this type

financial_connections()

View Source
@type financial_connections() :: %{
  optional(:permissions) => [
    :balances | :ownership | :payment_method | :transactions
  ],
  optional(:return_url) => binary()
}

Additional fields for Financial Connections Session creation

@type fpx() :: %{
  optional(:account_holder_type) => :company | :individual,
  optional(:bank) =>
    :affin_bank
    | :agrobank
    | :alliance_bank
    | :ambank
    | :bank_islam
    | :bank_muamalat
    | :bank_of_china
    | :bank_rakyat
    | :bsn
    | :cimb
    | :deutsche_bank
    | :hong_leong_bank
    | :hsbc
    | :kfh
    | :maybank2e
    | :maybank2u
    | :ocbc
    | :pb_enterprise
    | :public_bank
    | :rhb
    | :standard_chartered
    | :uob
}

If this is an fpx PaymentMethod, this hash contains details about the FPX payment method.

@type ideal() :: %{
  optional(:bank) =>
    :abn_amro
    | :asn_bank
    | :bunq
    | :handelsbanken
    | :ing
    | :knab
    | :moneyou
    | :rabobank
    | :regiobank
    | :revolut
    | :sns_bank
    | :triodos_bank
    | :van_lanschot
}

If this is an ideal PaymentMethod, this hash contains details about the iDEAL payment method.

@type klarna() :: %{optional(:dob) => dob()}

If this is a klarna PaymentMethod, this hash contains details about the Klarna payment method.

@type link() :: %{optional(:persistent_token) => binary()}

If this is a link PaymentMethod, this sub-hash contains details about the Link payment method options.

@type mandate_data() :: %{optional(:customer_acceptance) => customer_acceptance()}

This hash contains details about the Mandate to create. This parameter can only be used with confirm=true.

@type mandate_options() :: %{
  optional(:custom_mandate_url) => binary() | binary(),
  optional(:default_for) => [:invoice | :subscription],
  optional(:interval_description) => binary(),
  optional(:payment_schedule) => :combined | :interval | :sporadic,
  optional(:transaction_type) => :business | :personal
}

Additional fields for Mandate creation

@type networks() :: %{optional(:requested) => [:ach | :us_domestic_wire]}

Additional fields for network related functions

@type online() :: %{
  optional(:ip_address) => binary(),
  optional(:user_agent) => binary()
}

If this is a Mandate accepted online, this hash contains details about the online acceptance.

@type p24() :: %{
  optional(:bank) =>
    :alior_bank
    | :bank_millennium
    | :bank_nowy_bfg_sa
    | :bank_pekao_sa
    | :banki_spbdzielcze
    | :blik
    | :bnp_paribas
    | :boz
    | :citi_handlowy
    | :credit_agricole
    | :envelobank
    | :etransfer_pocztowy24
    | :getin_bank
    | :ideabank
    | :ing
    | :inteligo
    | :mbank_mtransfer
    | :nest_przelew
    | :noble_pay
    | :pbac_z_ipko
    | :plus_bank
    | :santander_przelew24
    | :tmobile_usbugi_bankowe
    | :toyota_bank
    | :volkswagen_bank
}

If this is a p24 PaymentMethod, this hash contains details about the P24 payment method.

@type payment_method_data() :: %{
  optional(:acss_debit) => acss_debit(),
  optional(:affirm) => map(),
  optional(:afterpay_clearpay) => map(),
  optional(:alipay) => map(),
  optional(:au_becs_debit) => au_becs_debit(),
  optional(:bacs_debit) => bacs_debit(),
  optional(:bancontact) => map(),
  optional(:billing_details) => billing_details(),
  optional(:blik) => map(),
  optional(:boleto) => boleto(),
  optional(:customer_balance) => map(),
  optional(:eps) => eps(),
  optional(:fpx) => fpx(),
  optional(:giropay) => map(),
  optional(:grabpay) => map(),
  optional(:ideal) => ideal(),
  optional(:interac_present) => map(),
  optional(:klarna) => klarna(),
  optional(:konbini) => map(),
  optional(:link) => map(),
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:oxxo) => map(),
  optional(:p24) => p24(),
  optional(:paynow) => map(),
  optional(:pix) => map(),
  optional(:promptpay) => map(),
  optional(:radar_options) => radar_options(),
  optional(:sepa_debit) => sepa_debit(),
  optional(:sofort) => sofort(),
  optional(:type) =>
    :acss_debit
    | :affirm
    | :afterpay_clearpay
    | :alipay
    | :au_becs_debit
    | :bacs_debit
    | :bancontact
    | :blik
    | :boleto
    | :customer_balance
    | :eps
    | :fpx
    | :giropay
    | :grabpay
    | :ideal
    | :klarna
    | :konbini
    | :link
    | :oxxo
    | :p24
    | :paynow
    | :pix
    | :promptpay
    | :sepa_debit
    | :sofort
    | :us_bank_account
    | :wechat_pay,
  optional(:us_bank_account) => us_bank_account(),
  optional(:wechat_pay) => map()
}

When included, this hash creates a PaymentMethod that is set as the payment_method value in the SetupIntent.

Link to this type

payment_method_options()

View Source
@type payment_method_options() :: %{
  optional(:acss_debit) => acss_debit(),
  optional(:blik) => blik(),
  optional(:card) => card(),
  optional(:link) => link(),
  optional(:sepa_debit) => sepa_debit(),
  optional(:us_bank_account) => us_bank_account()
}

Payment-method-specific configuration for this SetupIntent.

@type radar_options() :: %{optional(:session) => binary()}

Options to configure Radar. See Radar Session for more information.

@type sepa_debit() :: %{optional(:iban) => binary()}

If this is a sepa_debit PaymentMethod, this hash contains details about the SEPA debit bank account.

@type single_use() :: %{
  optional(:amount) => integer(),
  optional(:currency) => binary()
}

If this hash is populated, this SetupIntent will generate a single_use Mandate on success.

@type sofort() :: %{optional(:country) => :AT | :BE | :DE | :ES | :IT | :NL}

If this is a sofort PaymentMethod, this hash contains details about the SOFORT payment method.

@type t() :: %Stripe.SetupIntent{
  application: (binary() | term()) | nil,
  attach_to_self: boolean(),
  cancellation_reason: binary() | nil,
  client_secret: binary() | nil,
  created: integer(),
  customer: (binary() | Stripe.Customer.t() | Stripe.DeletedCustomer.t()) | nil,
  description: binary() | nil,
  flow_directions: term() | nil,
  id: binary(),
  last_setup_error: Stripe.ApiErrors.t() | nil,
  latest_attempt: (binary() | Stripe.SetupAttempt.t()) | nil,
  livemode: boolean(),
  mandate: (binary() | Stripe.Mandate.t()) | nil,
  metadata: term() | nil,
  next_action: term() | nil,
  object: binary(),
  on_behalf_of: (binary() | Stripe.Account.t()) | nil,
  payment_method: (binary() | Stripe.PaymentMethod.t()) | nil,
  payment_method_options: term() | nil,
  payment_method_types: term(),
  single_use_mandate: (binary() | Stripe.Mandate.t()) | nil,
  status: binary(),
  usage: binary()
}

The setup_intent type.

  • application ID of the Connect application that created the SetupIntent.
  • 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.

  • cancellation_reason Reason for cancellation of this SetupIntent, one of abandoned, requested_by_customer, or duplicate.
  • 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.

  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • 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.

  • description An arbitrary string attached to the object. Often useful for displaying to users.
  • 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.

  • id Unique identifier for the object.
  • last_setup_error The error encountered in the previous SetupIntent confirmation.
  • latest_attempt The most recent SetupAttempt for this SetupIntent.
  • 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.
  • 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.
  • next_action If present, this property tells you what actions you need to take in order for your customer to continue payment setup.
  • object String representing the object's type. Objects of the same type share the same value.
  • on_behalf_of The account (if any) for which the setup is intended.
  • payment_method ID of the payment method used with this SetupIntent.
  • payment_method_options Payment-method-specific configuration for this SetupIntent.
  • payment_method_types The list of payment method types (e.g. card) that this SetupIntent is allowed to set up.
  • single_use_mandate ID of the single_use Mandate generated by the SetupIntent.
  • status Status of this SetupIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, canceled, or 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.

@type us_bank_account() :: %{
  optional(:financial_connections) => financial_connections(),
  optional(:networks) => networks(),
  optional(:verification_method) => :automatic | :instant | :microdeposits
}

If this is a us_bank_account SetupIntent, this sub-hash contains details about the US bank account payment method options.

Link to this section Functions

Link to this function

cancel(client, intent, params \\ %{}, opts \\ [])

View Source
@spec cancel(
  client :: Stripe.t(),
  intent :: binary(),
  params :: %{
    optional(:cancellation_reason) =>
      :abandoned | :duplicate | :requested_by_customer,
    optional(:expand) => [binary()]
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_confirmation, or requires_action..

Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an error.

Details

  • Method: post
  • Path: /v1/setup_intents/{intent}/cancel
Link to this function

confirm(client, intent, params \\ %{}, opts \\ [])

View Source
@spec confirm(
  client :: Stripe.t(),
  intent :: binary(),
  params :: %{
    optional(:expand) => [binary()],
    optional(:mandate_data) => mandate_data() | mandate_data(),
    optional(:payment_method) => binary(),
    optional(:payment_method_data) => payment_method_data(),
    optional(:payment_method_options) => payment_method_options(),
    optional(:return_url) => binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Confirm that your customer intends to set up the current orprovided payment method. For example, you would confirm a SetupIntent when a customer hits the “Save” button on a payment method management page on your website.

If the selected payment method does not require any additionalsteps from the customer, the SetupIntent will transition to the succeeded status.

Otherwise, it will transition to the requires_action status andsuggest additional actions via next_action. If setup fails, the SetupIntent will transition to the requires_payment_method status.

Details

  • Method: post
  • Path: /v1/setup_intents/{intent}/confirm
Link to this function

create(client, params \\ %{}, opts \\ [])

View Source
@spec create(
  client :: Stripe.t(),
  params :: %{
    optional(:attach_to_self) => boolean(),
    optional(:confirm) => boolean(),
    optional(:customer) => binary(),
    optional(:description) => binary(),
    optional(:expand) => [binary()],
    optional(:flow_directions) => [:inbound | :outbound],
    optional(:mandate_data) => mandate_data(),
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:on_behalf_of) => binary(),
    optional(:payment_method) => binary(),
    optional(:payment_method_data) => payment_method_data(),
    optional(:payment_method_options) => payment_method_options(),
    optional(:payment_method_types) => [binary()],
    optional(:return_url) => binary(),
    optional(:single_use) => single_use(),
    optional(:usage) => :off_session | :on_session
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Creates a SetupIntent object.

After the SetupIntent is created, attach a payment method and confirmto collect any required permissions to charge the payment method later.

Details

  • Method: post
  • Path: /v1/setup_intents
Link to this function

list(client, params \\ %{}, opts \\ [])

View Source
@spec list(
  client :: Stripe.t(),
  params :: %{
    optional(:attach_to_self) => boolean(),
    optional(:created) => created() | integer(),
    optional(:customer) => binary(),
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:payment_method) => binary(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Returns a list of SetupIntents.

Details

  • Method: get
  • Path: /v1/setup_intents
Link to this function

retrieve(client, intent, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  client :: Stripe.t(),
  intent :: binary(),
  params :: %{
    optional(:client_secret) => binary(),
    optional(:expand) => [binary()]
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves the details of a SetupIntent that has previously been created..

Client-side retrieval using a publishable key is allowed when the client_secret is provided in the query string..

When retrieved with a publishable key, only a subset of properties will be returned. Please refer to the SetupIntent object reference for more details.

Details

  • Method: get
  • Path: /v1/setup_intents/{intent}
Link to this function

update(client, intent, params \\ %{}, opts \\ [])

View Source
@spec update(
  client :: Stripe.t(),
  intent :: binary(),
  params :: %{
    optional(:attach_to_self) => boolean(),
    optional(:customer) => binary(),
    optional(:description) => binary(),
    optional(:expand) => [binary()],
    optional(:flow_directions) => [:inbound | :outbound],
    optional(:metadata) => %{optional(binary()) => binary()} | binary(),
    optional(:payment_method) => binary(),
    optional(:payment_method_data) => payment_method_data(),
    optional(:payment_method_options) => payment_method_options(),
    optional(:payment_method_types) => [binary()]
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Updates a SetupIntent object.

Details

  • Method: post
  • Path: /v1/setup_intents/{intent}
Link to this function

verify_microdeposits(client, intent, params \\ %{}, opts \\ [])

View Source
@spec verify_microdeposits(
  client :: Stripe.t(),
  intent :: binary(),
  params :: %{
    optional(:amounts) => [integer()],
    optional(:descriptor_code) => binary(),
    optional(:expand) => [binary()]
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Verifies microdeposits on a SetupIntent object.

Details

  • Method: post
  • Path: /v1/setup_intents/{intent}/verify_microdeposits