Struct SetupIntent

Source
pub struct SetupIntent {
Show 25 fields pub application: Option<Value>, pub attach_to_self: Option<bool>, pub automatic_payment_methods: Option<Value>, pub cancellation_reason: Option<String>, pub client_secret: Option<String>, pub created: i64, pub customer: Option<Value>, pub description: Option<String>, pub flow_directions: Option<Vec<String>>, pub id: String, pub last_setup_error: Option<Value>, pub latest_attempt: Option<Value>, pub livemode: bool, pub mandate: Option<Value>, pub metadata: Option<Value>, pub next_action: Option<Value>, pub object: String, pub on_behalf_of: Option<Value>, pub payment_method: Option<Value>, pub payment_method_configuration_details: Option<Value>, pub payment_method_options: Option<Value>, pub payment_method_types: Vec<String>, pub single_use_mandate: Option<Value>, pub status: String, pub usage: String,
}
Expand description

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

Fields§

§application: Option<Value>

ID of the Connect application that created the SetupIntent.

§attach_to_self: Option<bool>

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: Option<Value>

Settings for dynamic payment methods compatible with this Setup Intent

§cancellation_reason: Option<String>

Reason for cancellation of this SetupIntent, one of abandoned, requested_by_customer, or duplicate.

§client_secret: Option<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.

§created: i64

Time at which the object was created. Measured in seconds since the Unix epoch.

§customer: Option<Value>

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: Option<String>

An arbitrary string attached to the object. Often useful for displaying to users.

§flow_directions: Option<Vec<String>>

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: String

Unique identifier for the object.

§last_setup_error: Option<Value>

The error encountered in the previous SetupIntent confirmation.

§latest_attempt: Option<Value>

The most recent SetupAttempt for this SetupIntent.

§livemode: bool

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

§mandate: Option<Value>

ID of the multi use Mandate generated by the SetupIntent.

§metadata: Option<Value>

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: Option<Value>

If present, this property tells you what actions you need to take in order for your customer to continue payment setup.

§object: String

String representing the object’s type. Objects of the same type share the same value.

§on_behalf_of: Option<Value>

The account (if any) for which the setup is intended.

§payment_method: Option<Value>

ID of the payment method used with this SetupIntent.

§payment_method_configuration_details: Option<Value>

Information about the payment method configuration used for this Setup Intent.

§payment_method_options: Option<Value>

Payment method-specific configuration for this SetupIntent.

§payment_method_types: Vec<String>

The list of payment method types (e.g. card) that this SetupIntent is allowed to set up.

§single_use_mandate: Option<Value>

ID of the single_use Mandate generated by the SetupIntent.

§status: String

Status of this SetupIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, canceled, or succeeded.

§usage: String

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.

Trait Implementations§

Source§

impl Clone for SetupIntent

Source§

fn clone(&self) -> SetupIntent

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SetupIntent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SetupIntent

Source§

fn default() -> SetupIntent

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SetupIntent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for SetupIntent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Serialize for SetupIntent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,