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
Functions
Cancel a SetupIntent
Confirm a SetupIntent
Create a SetupIntent
List all SetupIntents
Retrieve a SetupIntent
Update a SetupIntent
Verify microdeposits on a SetupIntent
Functions
@spec cancel(StripeElixir.Client.t(), String.t(), map(), keyword()) :: {:ok, term()} | {:error, StripeElixir.Error.t()}
Cancel a SetupIntent
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. You can’t cancel the SetupIntent for a Checkout Session. Expire the Checkout Session instead.
@spec confirm(StripeElixir.Client.t(), String.t(), map(), keyword()) :: {:ok, term()} | {:error, StripeElixir.Error.t()}
Confirm a SetupIntent
Confirm that your customer intends to set up the current or provided 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 additional
steps from the customer, the SetupIntent will transition to the
succeeded status.
Otherwise, it will transition to the requires_action status and
suggest 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(StripeElixir.Client.t(), map(), keyword()) :: {:ok, term()} | {:error, StripeElixir.Error.t()}
Create a SetupIntent
Creates a SetupIntent object.
After you create the SetupIntent, attach a payment method and confirm it to collect any required permissions to charge the payment method later.
@spec list(StripeElixir.Client.t(), map(), keyword()) :: {:ok, term()} | {:error, StripeElixir.Error.t()}
List all SetupIntents
Returns a list of SetupIntents.
@spec retrieve(StripeElixir.Client.t(), String.t(), map(), keyword()) :: {:ok, term()} | {:error, StripeElixir.Error.t()}
Retrieve a SetupIntent
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.
@spec update(StripeElixir.Client.t(), String.t(), map(), keyword()) :: {:ok, term()} | {:error, StripeElixir.Error.t()}
Update a SetupIntent
Updates a SetupIntent object.
@spec verify_microdeposits(StripeElixir.Client.t(), String.t(), map(), keyword()) :: {:ok, term()} | {:error, StripeElixir.Error.t()}
Verify microdeposits on a SetupIntent
Verifies microdeposits on a SetupIntent object.