Struct stripe::CheckoutSession

source ·
pub struct CheckoutSession {
Show 53 fields pub id: CheckoutSessionId, 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 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 expires_at: Timestamp, 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<Metadata>, pub mode: CheckoutSessionMode, 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 phone_number_collection: Option<PaymentPagesCheckoutSessionPhoneNumberCollection>, pub recovered_from: Option<String>, pub redirect_on_completion: Option<CheckoutSessionRedirectOnCompletion>, pub return_url: Option<String>, pub setup_intent: Option<Expandable<SetupIntent>>, pub shipping_address_collection: Option<PaymentPagesCheckoutSessionShippingAddressCollection>, pub shipping_cost: Option<PaymentPagesCheckoutSessionShippingCost>, pub shipping_details: Option<Shipping>, 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>,
}
Expand description

The resource representing a Stripe “Session”.

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

Fields§

§id: CheckoutSessionId

Unique identifier for the object.

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

§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>

Client secret to be used when initializing Stripe.js embedded checkout.

§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 automatic currency conversion sessions.

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

Only the customer’s email is 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.

§expires_at: Timestamp

The timestamp at which the Checkout Session will expire.

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

§mode: CheckoutSessionMode

The mode of the Checkout Session.

§payment_intent: Option<Expandable<PaymentIntent>>

The ID of the PaymentIntent for Checkout Sessions in payment mode.

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

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

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

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

§redirect_on_completion: Option<CheckoutSessionRedirectOnCompletion>

Applies to Checkout Sessions with ui_mode: embedded.

By default, Stripe will always redirect to your return_url after a successful confirmation. If you set redirect_on_completion: 'if_required', then we will only redirect if your user chooses a redirect-based payment method.

§return_url: Option<String>

Applies to Checkout Sessions with ui_mode: embedded.

The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method’s app or site.

§setup_intent: Option<Expandable<SetupIntent>>

The ID of the SetupIntent for Checkout Sessions in setup mode.

§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_details: Option<Shipping>

Shipping information for this Checkout Session.

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

Can be hosted (default) or embedded.

§url: Option<String>

The URL to the Checkout Session.

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.

Implementations§

source§

impl CheckoutSession

source

pub fn list( client: &Client, params: &ListCheckoutSessions<'_> ) -> Response<List<CheckoutSession>>

Returns a list of Checkout Sessions.

source

pub fn create( client: &Client, params: CreateCheckoutSession<'_> ) -> Response<CheckoutSession>

Creates a Session object.

source§

impl CheckoutSession

source

pub fn retrieve( client: &Client, id: &CheckoutSessionId, expand: &[&str] ) -> Response<CheckoutSession>

Retrieves a Session object.

For more details see https://stripe.com/docs/api/checkout/sessions/retrieve.

source

pub fn expire( client: &Client, id: &CheckoutSessionId ) -> Response<CheckoutSession>

Expires a checkout session.

For more details see https://stripe.com/docs/api/checkout/sessions/expire.

source

pub fn retrieve_line_items( client: &Client, id: &CheckoutSessionId, params: &RetrieveCheckoutSessionLineItems ) -> Response<List<CheckoutSessionItem>>

Retrieves a Checkout Session’s line items

For more details see https://docs.stripe.com/api/checkout/sessions/line_items

Trait Implementations§

source§

impl Clone for CheckoutSession

source§

fn clone(&self) -> CheckoutSession

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 CheckoutSession

source§

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

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

impl Default for CheckoutSession

source§

fn default() -> CheckoutSession

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

impl<'de> Deserialize<'de> for CheckoutSession

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 Object for CheckoutSession

§

type Id = CheckoutSessionId

The canonical id type for this object.
source§

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

The id of the object.
source§

fn object(&self) -> &'static str

The object’s type, typically represented in wire format as the object property.
source§

impl Serialize for CheckoutSession

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> 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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

§

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

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

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