SetupIntent class

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.

https://stripe.com/docs/api/setup_intents

Annotations
  • @freezed

Constructors

SetupIntent({required String id, @Default("setup_intent") String object, String? application, @JsonKey(name: "attach_to_self") String? attachToSelf, @JsonKey(name: "cancellation_reason") SetupIntentCancellationReason? cancellationReason, @JsonKey(name: "client_secret") required String clientSecret, int? created, String? customer, String? description, @JsonKey(name: "flow_directions") List<SetupIntentFlowDirections>? flowDirections, @JsonKey(name: "last_setup_error") dynamic lastSetupError, @JsonKey(name: "latest_attempt") String? latestAttempt, @Default(true) bool livemode, String? mandate, @Default({}) Map<String, dynamic> metadata, @JsonKey(name: "next_action") dynamic nextAction, @JsonKey(name: "on_behalf_of") String? onBehalfOf, @JsonKey(name: "payment_method") String? paymentMethod, @JsonKey(name: "payment_method_options") dynamic paymentMethodOptions, @JsonKey(name: "payment_method_types") @Default([]) List<PaymentMethodType> paymentMethodTypes, @JsonKey(name: "single_use_mandate") String? singleUseMandate, required SetupIntentsStatus status, @Default(SetupIntentUsage.offSession) SetupIntentUsage usage})
const
factory
SetupIntent.fromJson(Map<String, dynamic> json)
factory

Properties

application String?
CONNECT ONLY ID of the Connect application that created the SetupIntent.
no setterinherited
attachToSelf String?
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.
no setterinherited
cancellationReason SetupIntentCancellationReason?
Reason for cancellation of this SetupIntent, one of abandoned, requested_by_customer, or duplicate.
no setterinherited
clientSecret String
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.
no setterinherited
copyWith → $SetupIntentCopyWith<SetupIntent>
no setterinherited
created int?
Time at which the object was created. Measured in seconds since the Unix epoch.
no setterinherited
customer String?
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.
no setterinherited
description String?
An arbitrary string attached to the object. Often useful for displaying to users.
no setterinherited
flowDirections List<SetupIntentFlowDirections>?
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
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for the object.
no setterinherited
lastSetupError → dynamic
The error encountered in the previous SetupIntent confirmation.
no setterinherited
latestAttempt String?
The most recent SetupAttempt for this SetupIntent.
no setterinherited
livemode bool
Has the value true if the object exists in live mode or the value false if the object exists in test mode.
no setterinherited
mandate String?
ID of the multi use Mandate generated by the SetupIntent.
no setterinherited
metadata Map<String, dynamic>
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.
no setterinherited
nextAction → dynamic
If present, this property tells you what actions you need to take in order for your customer to continue payment setup.
no setterinherited
object String
String representing the object’s type. Objects of the same type share the same value. Value is "setup_intent".
no setterinherited
onBehalfOf String?
CONNECT ONLY The account (if any) for which the setup is intended.
no setterinherited
paymentMethod String?
ID of the payment method used in this SetupIntent.
no setterinherited
paymentMethodOptions → dynamic
Payment-method-specific configuration for this SetupIntent.
no setterinherited
paymentMethodTypes List<PaymentMethodType>
The list of payment method types (e.g. card) that this SetupIntent is allowed to set up.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
singleUseMandate String?
ID of the single_use Mandate generated by the SetupIntent.
no setterinherited
status SetupIntentsStatus
Status of this SetupIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, canceled, or succeeded.
no setterinherited
usage SetupIntentUsage
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.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited