Struct CheckoutSession

Source
pub struct CheckoutSession {
Show 60 fields pub adaptive_pricing: Option<PaymentPagesCheckoutSessionAdaptivePricing>, pub after_expiration: Option<PaymentPagesCheckoutSessionAfterExpiration>, pub allow_promotion_codes: Option<bool>, pub amount_subtotal: Option<i64>, pub amount_total: Option<i64>, pub automatic_tax: PaymentPagesCheckoutSessionAutomaticTax, pub billing_address_collection: Option<CheckoutSessionBillingAddressCollection>, pub cancel_url: Option<String>, pub client_reference_id: Option<String>, pub client_secret: Option<String>, pub collected_information: Option<PaymentPagesCheckoutSessionCollectedInformation>, pub consent: Option<PaymentPagesCheckoutSessionConsent>, pub consent_collection: Option<PaymentPagesCheckoutSessionConsentCollection>, pub created: Timestamp, pub currency: Option<Currency>, pub currency_conversion: Option<PaymentPagesCheckoutSessionCurrencyConversion>, pub custom_fields: Vec<PaymentPagesCheckoutSessionCustomFields>, pub custom_text: PaymentPagesCheckoutSessionCustomText, pub customer: Option<Expandable<Customer>>, pub customer_creation: Option<CheckoutSessionCustomerCreation>, pub customer_details: Option<PaymentPagesCheckoutSessionCustomerDetails>, pub customer_email: Option<String>, pub discounts: Option<Vec<PaymentPagesCheckoutSessionDiscount>>, pub expires_at: Timestamp, pub id: CheckoutSessionId, pub invoice: Option<Expandable<Invoice>>, pub invoice_creation: Option<PaymentPagesCheckoutSessionInvoiceCreation>, pub line_items: Option<List<CheckoutSessionItem>>, pub livemode: bool, pub locale: Option<CheckoutSessionLocale>, pub metadata: Option<HashMap<String, String>>, pub mode: CheckoutSessionMode, pub optional_items: Option<Vec<PaymentPagesCheckoutSessionOptionalItem>>, pub payment_intent: Option<Expandable<PaymentIntent>>, pub payment_link: Option<Expandable<PaymentLink>>, pub payment_method_collection: Option<CheckoutSessionPaymentMethodCollection>, pub payment_method_configuration_details: Option<PaymentMethodConfigBizPaymentMethodConfigurationDetails>, pub payment_method_options: Option<CheckoutSessionPaymentMethodOptions>, pub payment_method_types: Vec<String>, pub payment_status: CheckoutSessionPaymentStatus, pub permissions: Option<PaymentPagesCheckoutSessionPermissions>, pub phone_number_collection: Option<PaymentPagesCheckoutSessionPhoneNumberCollection>, pub presentment_details: Option<PaymentFlowsPaymentIntentPresentmentDetails>, pub recovered_from: Option<String>, pub redirect_on_completion: Option<CheckoutSessionRedirectOnCompletion>, pub return_url: Option<String>, pub saved_payment_method_options: Option<PaymentPagesCheckoutSessionSavedPaymentMethodOptions>, pub setup_intent: Option<Expandable<SetupIntent>>, pub shipping_address_collection: Option<PaymentPagesCheckoutSessionShippingAddressCollection>, pub shipping_cost: Option<PaymentPagesCheckoutSessionShippingCost>, pub shipping_options: Vec<PaymentPagesCheckoutSessionShippingOption>, pub status: Option<CheckoutSessionStatus>, pub submit_type: Option<CheckoutSessionSubmitType>, pub subscription: Option<Expandable<Subscription>>, pub success_url: Option<String>, pub tax_id_collection: Option<PaymentPagesCheckoutSessionTaxIdCollection>, pub total_details: Option<PaymentPagesCheckoutSessionTotalDetails>, pub ui_mode: Option<CheckoutSessionUiMode>, pub url: Option<String>, pub wallet_options: Option<CheckoutSessionWalletOptions>,
}
Expand description

A Checkout Session represents your customer’s session as they pay for one-time purchases or subscriptions through Checkout or Payment Links. We recommend creating a new Session each time your customer attempts to pay.

Once payment is successful, the Checkout Session will contain a reference to the Customer, and either the successful PaymentIntent or an active Subscription.

You can create a Checkout Session on your server and redirect to its URL to begin Checkout.

Related guide: Checkout quickstart

For more details see <https://stripe.com/docs/api/checkout/sessions/object>.

Fields§

§adaptive_pricing: Option<PaymentPagesCheckoutSessionAdaptivePricing>

Settings for price localization with Adaptive Pricing.

§after_expiration: Option<PaymentPagesCheckoutSessionAfterExpiration>

When set, provides configuration for actions to take if this Checkout Session expires.

§allow_promotion_codes: Option<bool>

Enables user redeemable promotion codes.

§amount_subtotal: Option<i64>

Total of all items before discounts or taxes are applied.

§amount_total: Option<i64>

Total of all items after discounts and taxes are applied.

§automatic_tax: PaymentPagesCheckoutSessionAutomaticTax§billing_address_collection: Option<CheckoutSessionBillingAddressCollection>

Describes whether Checkout should collect the customer’s billing address. Defaults to auto.

§cancel_url: Option<String>

If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website.

§client_reference_id: Option<String>

A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems.

§client_secret: Option<String>

The client secret of your Checkout Session. Applies to Checkout Sessions with ui_mode: embedded or ui_mode: custom. For ui_mode: embedded, the client secret is to be used when initializing Stripe.js embedded checkout. For ui_mode: custom, use the client secret with initCheckout on your front end.

§collected_information: Option<PaymentPagesCheckoutSessionCollectedInformation>

Information about the customer collected within the Checkout Session.

§consent: Option<PaymentPagesCheckoutSessionConsent>

Results of consent_collection for this session.

§consent_collection: Option<PaymentPagesCheckoutSessionConsentCollection>

When set, provides configuration for the Checkout Session to gather active consent from customers.

§created: Timestamp

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

§currency: Option<Currency>

Three-letter ISO currency code, in lowercase. Must be a supported currency.

§currency_conversion: Option<PaymentPagesCheckoutSessionCurrencyConversion>

Currency conversion details for Adaptive Pricing sessions created before 2025-03-31.

§custom_fields: Vec<PaymentPagesCheckoutSessionCustomFields>

Collect additional information from your customer using custom fields. Up to 3 fields are supported.

§custom_text: PaymentPagesCheckoutSessionCustomText§customer: Option<Expandable<Customer>>

The ID of the customer for this Session. For Checkout Sessions in subscription mode or Checkout Sessions with customer_creation set as always in payment mode, Checkout. will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created.

§customer_creation: Option<CheckoutSessionCustomerCreation>

Configure whether a Checkout Session creates a Customer when the Checkout Session completes.

§customer_details: Option<PaymentPagesCheckoutSessionCustomerDetails>

The customer details including the customer’s tax exempt status and the customer’s tax IDs. Customer’s address details are not present on Sessions in setup mode.

§customer_email: Option<String>

If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the customer attribute.

§discounts: Option<Vec<PaymentPagesCheckoutSessionDiscount>>

List of coupons and promotion codes attached to the Checkout Session.

§expires_at: Timestamp

The timestamp at which the Checkout Session will expire.

§id: CheckoutSessionId

Unique identifier for the object.

§invoice: Option<Expandable<Invoice>>

ID of the invoice created by the Checkout Session, if it exists.

§invoice_creation: Option<PaymentPagesCheckoutSessionInvoiceCreation>

Details on the state of invoice creation for the Checkout Session.

§line_items: Option<List<CheckoutSessionItem>>

The line items purchased by the customer.

§livemode: bool

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

§locale: Option<CheckoutSessionLocale>

The IETF language tag of the locale Checkout is displayed in. If blank or auto, the browser’s locale is used.

§metadata: Option<HashMap<String, String>>

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.

§mode: CheckoutSessionMode

The mode of the Checkout Session.

§optional_items: Option<Vec<PaymentPagesCheckoutSessionOptionalItem>>

The optional items presented to the customer at checkout.

§payment_intent: Option<Expandable<PaymentIntent>>

The ID of the PaymentIntent for Checkout Sessions in payment mode. You can’t confirm or cancel the PaymentIntent for a Checkout Session. To cancel, expire the Checkout Session instead.

§payment_link: Option<Expandable<PaymentLink>>

The ID of the Payment Link that created this Session.

§payment_method_collection: Option<CheckoutSessionPaymentMethodCollection>

Configure whether a Checkout Session should collect a payment method. Defaults to always.

§payment_method_configuration_details: Option<PaymentMethodConfigBizPaymentMethodConfigurationDetails>

Information about the payment method configuration used for this Checkout session if using dynamic payment methods.

§payment_method_options: Option<CheckoutSessionPaymentMethodOptions>

Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.

§payment_method_types: Vec<String>

A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.

§payment_status: CheckoutSessionPaymentStatus

The payment status of the Checkout Session, one of paid, unpaid, or no_payment_required. You can use this value to decide when to fulfill your customer’s order.

§permissions: Option<PaymentPagesCheckoutSessionPermissions>

This property is used to set up permissions for various actions (e.g., update) on the CheckoutSession object.

For specific permissions, please refer to their dedicated subsections, such as permissions.update_shipping_details.

§phone_number_collection: Option<PaymentPagesCheckoutSessionPhoneNumberCollection>§presentment_details: Option<PaymentFlowsPaymentIntentPresentmentDetails>§recovered_from: Option<String>

The ID of the original expired Checkout Session that triggered the recovery flow.

§redirect_on_completion: Option<CheckoutSessionRedirectOnCompletion>

This parameter applies to ui_mode: embedded. Learn more about the redirect behavior of embedded sessions. Defaults to always.

§return_url: Option<String>

Applies to Checkout Sessions with ui_mode: embedded or ui_mode: custom. The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method’s app or site.

§saved_payment_method_options: Option<PaymentPagesCheckoutSessionSavedPaymentMethodOptions>

Controls saved payment method settings for the session. Only available in payment and subscription mode.

§setup_intent: Option<Expandable<SetupIntent>>

The ID of the SetupIntent for Checkout Sessions in setup mode. You can’t confirm or cancel the SetupIntent for a Checkout Session. To cancel, expire the Checkout Session instead.

§shipping_address_collection: Option<PaymentPagesCheckoutSessionShippingAddressCollection>

When set, provides configuration for Checkout to collect a shipping address from a customer.

§shipping_cost: Option<PaymentPagesCheckoutSessionShippingCost>

The details of the customer cost of shipping, including the customer chosen ShippingRate.

§shipping_options: Vec<PaymentPagesCheckoutSessionShippingOption>

The shipping rate options applied to this Session.

§status: Option<CheckoutSessionStatus>

The status of the Checkout Session, one of open, complete, or expired.

§submit_type: Option<CheckoutSessionSubmitType>

Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. submit_type can only be specified on Checkout Sessions in payment mode. If blank or auto, pay is used.

§subscription: Option<Expandable<Subscription>>

The ID of the subscription for Checkout Sessions in subscription mode.

§success_url: Option<String>

The URL the customer will be directed to after the payment or subscription creation is successful.

§tax_id_collection: Option<PaymentPagesCheckoutSessionTaxIdCollection>§total_details: Option<PaymentPagesCheckoutSessionTotalDetails>

Tax and discount details for the computed total amount.

§ui_mode: Option<CheckoutSessionUiMode>

The UI mode of the Session. Defaults to hosted.

§url: Option<String>

The URL to the Checkout Session. Applies to Checkout Sessions with ui_mode: hosted. Redirect customers to this URL to take them to Checkout. If you’re using Custom Domains, the URL will use your subdomain. Otherwise, it’ll use checkout.stripe.com.. This value is only present when the session is active.

§wallet_options: Option<CheckoutSessionWalletOptions>

Wallet-specific configuration for this Checkout Session.

Trait Implementations§

Source§

impl Clone for CheckoutSession

Source§

fn clone(&self) -> CheckoutSession

Returns a duplicate 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 CheckoutSession

Source§

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

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

impl Deserialize for CheckoutSession

Source§

fn begin(out: &mut Option<Self>) -> &mut dyn Visitor

The only correct implementation of this method is: Read more
Source§

impl FromValueOpt for CheckoutSession

Source§

impl Object for CheckoutSession

Source§

type Id = CheckoutSessionId

The canonical id type for this object.
Source§

fn id(&self) -> &Self::Id

The id of the object.
Source§

fn into_id(self) -> Self::Id

The owned id of the object.
Source§

impl ObjectDeser for CheckoutSession

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.