View Source Stripe.SetupIntent (stripity_stripe v3.2.0)
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
If this is an acss_debit
PaymentMethod, this hash contains details about the ACSS Debit payment method.
If this is an au_becs_debit
PaymentMethod, this hash contains details about the bank account.
When you enable this parameter, this SetupIntent accepts payment methods that you enable in the Dashboard and that are compatible with its other parameters.
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 boleto
PaymentMethod, this hash contains details about the Boleto payment method.
Configuration for any card setup attempted on this SetupIntent.
Cartes Bancaires-specific 3DS fields.
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.
Additional fields for Mandate creation
Network specific 3DS fields. Network specific arguments require an explicit card brand choice. The parameter `payment_method_options.card.network`` must be populated accordingly
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.
If this is a paypal
PaymentMethod, this sub-hash contains details about the PayPal payment method options.
Options to configure Radar. See Radar Session for more information.
If this is a sepa_debit
SetupIntent, this sub-hash contains details about the SEPA Debit payment method options.
If you populate this hash, this SetupIntent generates a single_use
mandate after successful completion.
If this is a sofort
PaymentMethod, this hash contains details about the SOFORT payment method.
The setup_intent
type.
If 3D Secure authentication was performed with a third-party provider, the authentication details to use for this setup.
If this is an us_bank_account
PaymentMethod, this hash contains details about the US bank account payment method.
Functions
You can cancel a SetupIntent object when it’s 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.
Updates a SetupIntent object.
Verifies microdeposits on a SetupIntent object.
Types
@type acss_debit() :: %{ optional(:account_number) => binary(), optional(:institution_number) => binary(), optional(:transit_number) => binary() }
If this is an acss_debit
PaymentMethod, this hash contains details about the ACSS Debit payment method.
@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 automatic_payment_methods() :: %{ optional(:allow_redirects) => :always | :never, optional(:enabled) => boolean() }
When you enable this parameter, this SetupIntent accepts payment methods that you enable in the Dashboard and that are compatible with its other parameters.
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() | binary(), optional(:phone) => binary() | binary() }
Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
@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 | :eftpos_au | :interac | :jcb | :mastercard | :unionpay | :unknown | :visa, optional(:request_three_d_secure) => :any | :automatic | :challenge, optional(:three_d_secure) => three_d_secure() }
Configuration for any card setup attempted on this SetupIntent.
@type cartes_bancaires() :: %{ optional(:cb_avalgo) => :"0" | :"1" | :"2" | :"3" | :"4" | :A, optional(:cb_exemption) => binary(), optional(:cb_score) => integer() }
Cartes Bancaires-specific 3DS fields.
@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.
@type financial_connections() :: %{ optional(:permissions) => [ :balances | :ownership | :payment_method | :transactions ], optional(:prefetch) => [:balances | :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
| :n26
| :rabobank
| :regiobank
| :revolut
| :sns_bank
| :triodos_bank
| :van_lanschot
| :yoursafe
}
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()}
@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 network_options() :: %{optional(:cartes_bancaires) => cartes_bancaires()}
Network specific 3DS fields. Network specific arguments require an explicit card brand choice. The parameter `payment_method_options.card.network`` must be populated accordingly
@type networks() :: %{optional(:requested) => [:ach | :us_domestic_wire]}
Additional fields for network related functions
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(:pix) => map(), optional(:fpx) => fpx(), optional(:affirm) => map(), optional(:acss_debit) => acss_debit(), optional(:bacs_debit) => bacs_debit(), optional(:alipay) => map(), optional(:giropay) => map(), optional(:ideal) => ideal(), optional(:revolut_pay) => map(), optional(:radar_options) => radar_options(), optional(:metadata) => %{optional(binary()) => binary()}, optional(:link) => map(), optional(:promptpay) => map(), optional(:cashapp) => map(), optional(:oxxo) => map(), optional(:interac_present) => map(), optional(:us_bank_account) => us_bank_account(), optional(:zip) => map(), optional(:paypal) => map(), optional(:boleto) => boleto(), optional(:konbini) => map(), optional(:billing_details) => billing_details(), optional(:blik) => map(), optional(:wechat_pay) => map(), optional(:sofort) => sofort(), optional(:p24) => p24(), optional(:afterpay_clearpay) => map(), optional(:type) => :acss_debit | :affirm | :afterpay_clearpay | :alipay | :au_becs_debit | :bacs_debit | :bancontact | :blik | :boleto | :cashapp | :customer_balance | :eps | :fpx | :giropay | :grabpay | :ideal | :klarna | :konbini | :link | :oxxo | :p24 | :paynow | :paypal | :pix | :promptpay | :revolut_pay | :sepa_debit | :sofort | :us_bank_account | :wechat_pay | :zip, optional(:grabpay) => map(), optional(:bancontact) => map(), optional(:au_becs_debit) => au_becs_debit(), optional(:customer_balance) => map(), optional(:sepa_debit) => sepa_debit(), optional(:klarna) => klarna(), optional(:paynow) => map(), optional(:eps) => eps() }
When included, this hash creates a PaymentMethod that is set as the payment_method
value in the SetupIntent.
@type payment_method_options() :: %{ optional(:acss_debit) => acss_debit(), optional(:card) => card(), optional(:link) => link(), optional(:paypal) => paypal(), optional(:sepa_debit) => sepa_debit(), optional(:us_bank_account) => us_bank_account() }
Payment method-specific configuration for this SetupIntent.
@type paypal() :: %{optional(:billing_agreement_id) => binary()}
If this is a paypal
PaymentMethod, this sub-hash contains details about the PayPal payment method options.
@type radar_options() :: %{optional(:session) => binary()}
Options to configure Radar. See Radar Session for more information.
@type sepa_debit() :: %{optional(:mandate_options) => map()}
If this is a sepa_debit
SetupIntent, this sub-hash contains details about the SEPA Debit payment method options.
If you populate this hash, this SetupIntent generates a single_use
mandate after successful completion.
@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(), automatic_payment_methods: term() | nil, 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_configuration_details: term() | 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.
automatic_payment_methods
Settings for dynamic payment methods compatible with this Setup Intentcancellation_reason
Reason for cancellation of this SetupIntent, one ofabandoned
,requested_by_customer
, orduplicate
.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 valuetrue
if the object exists in live mode or the valuefalse
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_configuration_details
Information about the payment method configuration used for this Setup Intent.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 ofrequires_payment_method
,requires_confirmation
,requires_action
,processing
,canceled
, orsucceeded
.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 three_d_secure() :: %{ optional(:ares_trans_status) => :A | :C | :I | :N | :R | :U | :Y, optional(:cryptogram) => binary(), optional(:electronic_commerce_indicator) => :"01" | :"02" | :"05" | :"06" | :"07", optional(:network_options) => network_options(), optional(:requestor_challenge_indicator) => binary(), optional(:transaction_id) => binary(), optional(:version) => :"1.0.2" | :"2.1.0" | :"2.2.0" }
If 3D Secure authentication was performed with a third-party provider, the authentication details to use for this setup.
@type us_bank_account() :: %{ optional(:account_holder_type) => :company | :individual, optional(:account_number) => binary(), optional(:account_type) => :checking | :savings, optional(:financial_connections_account) => binary(), optional(:routing_number) => binary() }
If this is an us_bank_account
PaymentMethod, this hash contains details about the US bank account payment method.
Functions
@spec cancel( 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()}
You can cancel a SetupIntent object when it’s in one of these statuses: requires_payment_method
, requires_confirmation
, or requires_action
.
After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
Details
- Method:
post
- Path:
/v1/setup_intents/{intent}/cancel
@spec confirm( intent :: binary(), params :: %{ optional(:expand) => [binary()], optional(:mandate_data) => mandate_data() | binary() | mandate_data(), optional(:payment_method) => binary(), optional(:payment_method_data) => payment_method_data(), optional(:payment_method_options) => payment_method_options(), optional(:return_url) => binary(), optional(:use_stripe_sdk) => boolean() }, 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 or the canceled
status if the
confirmation limit is reached.
@spec create( params :: %{ optional(:attach_to_self) => boolean(), optional(:automatic_payment_methods) => automatic_payment_methods(), optional(:confirm) => boolean(), optional(:customer) => binary(), optional(:description) => binary(), optional(:expand) => [binary()], optional(:flow_directions) => [:inbound | :outbound], optional(:mandate_data) => mandate_data() | binary(), optional(:metadata) => %{optional(binary()) => binary()}, optional(:on_behalf_of) => binary(), optional(:payment_method) => binary(), optional(:payment_method_configuration) => 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, optional(:use_stripe_sdk) => boolean() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Creates a SetupIntent object.
After you create the SetupIntent, attach a payment method and confirmit to collect any required permissions to charge the payment method later.
#### Details * Method: `post` * Path: `/v1/setup_intents`@spec list( 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
@spec retrieve( 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}
@spec update( 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_configuration) => 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}
@spec verify_microdeposits( 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