Class: Stripe::Checkout::Session

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List
Includes:
APIOperations::Save
Defined in:
lib/stripe/resources/checkout/session.rb

Overview

A Checkout Session represents your customer’s session as they pay for one-time purchases or subscriptions through [Checkout](docs.stripe.com/payments/checkout) or [Payment Links](docs.stripe.com/payments/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](docs.stripe.com/api/customers), and either the successful [PaymentIntent](docs.stripe.com/api/payment_intents) or an active [Subscription](docs.stripe.com/api/subscriptions).

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

Related guide: [Checkout quickstart](docs.stripe.com/checkout/quickstart)

Defined Under Namespace

Classes: AdaptivePricing, AfterExpiration, AutomaticTax, BrandingSettings, CheckoutItem, CollectedInformation, Consent, ConsentCollection, CurrencyConversion, CurrentAttempt, CustomField, CustomText, CustomerDetails, Discount, InvoiceCreation, ManagedPayments, NameCollection, OptionalItem, PaymentMethodConfigurationDetails, PaymentMethodOptions, Permissions, PhoneNumberCollection, PresentmentDetails, SavedPaymentMethodOptions, ShippingAddressCollection, ShippingCost, ShippingOption, TaxIdCollection, TotalDetails, WalletOptions

Constant Summary collapse

OBJECT_NAME =
"checkout.session"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#adaptive_pricingObject (readonly)

Settings for price localization with [Adaptive Pricing](docs.stripe.com/payments/checkout/adaptive-pricing).



2618
2619
2620
# File 'lib/stripe/resources/checkout/session.rb', line 2618

def adaptive_pricing
  @adaptive_pricing
end

#after_expirationObject (readonly)

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



2620
2621
2622
# File 'lib/stripe/resources/checkout/session.rb', line 2620

def after_expiration
  @after_expiration
end

#allow_promotion_codesObject (readonly)

Enables user redeemable promotion codes.



2622
2623
2624
# File 'lib/stripe/resources/checkout/session.rb', line 2622

def allow_promotion_codes
  @allow_promotion_codes
end

#amount_subtotalObject (readonly)

Total of all items before discounts or taxes are applied.



2624
2625
2626
# File 'lib/stripe/resources/checkout/session.rb', line 2624

def amount_subtotal
  @amount_subtotal
end

#amount_totalObject (readonly)

Total of all items after discounts and taxes are applied.



2626
2627
2628
# File 'lib/stripe/resources/checkout/session.rb', line 2626

def amount_total
  @amount_total
end

#approval_methodObject (readonly)

Determines whether the customer’s attempt to pay must be manually approved.

Default is ‘auto`, when the customer’s attempt to pay is approved automatically with no action required on your server.

When set to ‘manual`, you must approve the customer’s attempt to pay by calling [approve](api/checkout/sessions/approve) from your server.



2632
2633
2634
# File 'lib/stripe/resources/checkout/session.rb', line 2632

def approval_method
  @approval_method
end

#automatic_taxObject (readonly)

Attribute for field automatic_tax



2634
2635
2636
# File 'lib/stripe/resources/checkout/session.rb', line 2634

def automatic_tax
  @automatic_tax
end

#billing_address_collectionObject (readonly)

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



2636
2637
2638
# File 'lib/stripe/resources/checkout/session.rb', line 2636

def billing_address_collection
  @billing_address_collection
end

#branding_settingsObject (readonly)

Attribute for field branding_settings



2638
2639
2640
# File 'lib/stripe/resources/checkout/session.rb', line 2638

def branding_settings
  @branding_settings
end

#cancel_urlObject (readonly)

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.



2640
2641
2642
# File 'lib/stripe/resources/checkout/session.rb', line 2640

def cancel_url
  @cancel_url
end

#checkout_itemsObject (readonly)

Attribute for field checkout_items



2781
2782
2783
# File 'lib/stripe/resources/checkout/session.rb', line 2781

def checkout_items
  @checkout_items
end

#client_reference_idObject (readonly)

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.



2644
2645
2646
# File 'lib/stripe/resources/checkout/session.rb', line 2644

def client_reference_id
  @client_reference_id
end

#client_secretObject (readonly)

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](https://docs.stripe.com/js/custom_checkout/init) on your front end.


2647
2648
2649
# File 'lib/stripe/resources/checkout/session.rb', line 2647

def client_secret
  @client_secret
end

#collected_informationObject (readonly)

Information about the customer collected within the Checkout Session.



2649
2650
2651
# File 'lib/stripe/resources/checkout/session.rb', line 2649

def collected_information
  @collected_information
end

Results of ‘consent_collection` for this session.



2651
2652
2653
# File 'lib/stripe/resources/checkout/session.rb', line 2651

def consent
  @consent
end

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



2653
2654
2655
# File 'lib/stripe/resources/checkout/session.rb', line 2653

def consent_collection
  @consent_collection
end

#createdObject (readonly)

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



2655
2656
2657
# File 'lib/stripe/resources/checkout/session.rb', line 2655

def created
  @created
end

#currencyObject (readonly)

Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).



2657
2658
2659
# File 'lib/stripe/resources/checkout/session.rb', line 2657

def currency
  @currency
end

#currency_conversionObject (readonly)

Currency conversion details for [Adaptive Pricing](docs.stripe.com/payments/checkout/adaptive-pricing) sessions created before 2025-03-31.



2659
2660
2661
# File 'lib/stripe/resources/checkout/session.rb', line 2659

def currency_conversion
  @currency_conversion
end

#current_attemptObject (readonly)

The customer’s pending attempt to pay that requires your approval. Contains information about the customer and their payment details.



2661
2662
2663
# File 'lib/stripe/resources/checkout/session.rb', line 2661

def current_attempt
  @current_attempt
end

#custom_fieldsObject (readonly)

Collect additional information from your customer using custom fields. Up to 3 fields are supported. You can’t set this parameter if ‘ui_mode` is `custom`.



2663
2664
2665
# File 'lib/stripe/resources/checkout/session.rb', line 2663

def custom_fields
  @custom_fields
end

#custom_textObject (readonly)

Attribute for field custom_text



2665
2666
2667
# File 'lib/stripe/resources/checkout/session.rb', line 2665

def custom_text
  @custom_text
end

#customerObject (readonly)

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.



2671
2672
2673
# File 'lib/stripe/resources/checkout/session.rb', line 2671

def customer
  @customer
end

#customer_accountObject (readonly)

The ID of the account for this Session.



2673
2674
2675
# File 'lib/stripe/resources/checkout/session.rb', line 2673

def 
  @customer_account
end

#customer_creationObject (readonly)

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



2675
2676
2677
# File 'lib/stripe/resources/checkout/session.rb', line 2675

def customer_creation
  @customer_creation
end

#customer_detailsObject (readonly)

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.



2677
2678
2679
# File 'lib/stripe/resources/checkout/session.rb', line 2677

def customer_details
  @customer_details
end

#customer_emailObject (readonly)

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.



2683
2684
2685
# File 'lib/stripe/resources/checkout/session.rb', line 2683

def customer_email
  @customer_email
end

#discountsObject (readonly)

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



2685
2686
2687
# File 'lib/stripe/resources/checkout/session.rb', line 2685

def discounts
  @discounts
end

#excluded_payment_method_typesObject (readonly)

A list of the types of payment methods (e.g., ‘card`) that should be excluded from this Checkout Session. This should only be used when payment methods for this Checkout Session are managed through the [Stripe Dashboard](dashboard.stripe.com/settings/payment_methods).



2687
2688
2689
# File 'lib/stripe/resources/checkout/session.rb', line 2687

def excluded_payment_method_types
  @excluded_payment_method_types
end

#expires_atObject (readonly)

The timestamp at which the Checkout Session will expire.



2689
2690
2691
# File 'lib/stripe/resources/checkout/session.rb', line 2689

def expires_at
  @expires_at
end

#idObject (readonly)

Unique identifier for the object.



2691
2692
2693
# File 'lib/stripe/resources/checkout/session.rb', line 2691

def id
  @id
end

#integration_identifierObject (readonly)

The integration identifier for this Checkout Session. Multiple Checkout Sessions can have the same integration identifier.



2693
2694
2695
# File 'lib/stripe/resources/checkout/session.rb', line 2693

def integration_identifier
  @integration_identifier
end

#invoiceObject (readonly)

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



2695
2696
2697
# File 'lib/stripe/resources/checkout/session.rb', line 2695

def invoice
  @invoice
end

#invoice_creationObject (readonly)

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



2697
2698
2699
# File 'lib/stripe/resources/checkout/session.rb', line 2697

def invoice_creation
  @invoice_creation
end

#line_itemsObject (readonly)

The line items purchased by the customer.



2699
2700
2701
# File 'lib/stripe/resources/checkout/session.rb', line 2699

def line_items
  @line_items
end

#livemodeObject (readonly)

If the object exists in live mode, the value is ‘true`. If the object exists in test mode, the value is `false`.



2701
2702
2703
# File 'lib/stripe/resources/checkout/session.rb', line 2701

def livemode
  @livemode
end

#localeObject (readonly)

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



2703
2704
2705
# File 'lib/stripe/resources/checkout/session.rb', line 2703

def locale
  @locale
end

#managed_paymentsObject (readonly)

Settings for Managed Payments for this Checkout Session and resulting [PaymentIntents](/api/payment_intents/object), [Invoices](/api/invoices/object), and [Subscriptions](/api/subscriptions/object).



2705
2706
2707
# File 'lib/stripe/resources/checkout/session.rb', line 2705

def managed_payments
  @managed_payments
end

#metadataObject (readonly)

Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



2707
2708
2709
# File 'lib/stripe/resources/checkout/session.rb', line 2707

def 
  @metadata
end

#modeObject (readonly)

The mode of the Checkout Session.



2709
2710
2711
# File 'lib/stripe/resources/checkout/session.rb', line 2709

def mode
  @mode
end

#name_collectionObject (readonly)

Attribute for field name_collection



2711
2712
2713
# File 'lib/stripe/resources/checkout/session.rb', line 2711

def name_collection
  @name_collection
end

#objectObject (readonly)

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



2713
2714
2715
# File 'lib/stripe/resources/checkout/session.rb', line 2713

def object
  @object
end

#optional_itemsObject (readonly)

The optional items presented to the customer at checkout.



2715
2716
2717
# File 'lib/stripe/resources/checkout/session.rb', line 2715

def optional_items
  @optional_items
end

#origin_contextObject (readonly)

Where the user is coming from. This informs the optimizations that are applied to the session.



2717
2718
2719
# File 'lib/stripe/resources/checkout/session.rb', line 2717

def origin_context
  @origin_context
end

#payment_intentObject (readonly)

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](docs.stripe.com/api/checkout/sessions/expire) instead.



2719
2720
2721
# File 'lib/stripe/resources/checkout/session.rb', line 2719

def payment_intent
  @payment_intent
end

The ID of the Payment Link that created this Session.



2721
2722
2723
# File 'lib/stripe/resources/checkout/session.rb', line 2721

def payment_link
  @payment_link
end

#payment_method_collectionObject (readonly)

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



2723
2724
2725
# File 'lib/stripe/resources/checkout/session.rb', line 2723

def payment_method_collection
  @payment_method_collection
end

#payment_method_configuration_detailsObject (readonly)

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



2725
2726
2727
# File 'lib/stripe/resources/checkout/session.rb', line 2725

def payment_method_configuration_details
  @payment_method_configuration_details
end

#payment_method_optionsObject (readonly)

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



2727
2728
2729
# File 'lib/stripe/resources/checkout/session.rb', line 2727

def payment_method_options
  @payment_method_options
end

#payment_method_typesObject (readonly)

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



2730
2731
2732
# File 'lib/stripe/resources/checkout/session.rb', line 2730

def payment_method_types
  @payment_method_types
end

#payment_statusObject (readonly)

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.



2733
2734
2735
# File 'lib/stripe/resources/checkout/session.rb', line 2733

def payment_status
  @payment_status
end

#permissionsObject (readonly)

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



2737
2738
2739
# File 'lib/stripe/resources/checkout/session.rb', line 2737

def permissions
  @permissions
end

#phone_number_collectionObject (readonly)

Attribute for field phone_number_collection



2739
2740
2741
# File 'lib/stripe/resources/checkout/session.rb', line 2739

def phone_number_collection
  @phone_number_collection
end

#presentment_detailsObject (readonly)

Attribute for field presentment_details



2741
2742
2743
# File 'lib/stripe/resources/checkout/session.rb', line 2741

def presentment_details
  @presentment_details
end

#recovered_fromObject (readonly)

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



2743
2744
2745
# File 'lib/stripe/resources/checkout/session.rb', line 2743

def recovered_from
  @recovered_from
end

#redirect_on_completionObject (readonly)

This parameter applies to ‘ui_mode: embedded`. Learn more about the [redirect behavior](docs.stripe.com/payments/checkout/custom-success-page?payment-ui=embedded-form) of embedded sessions. Defaults to `always`.



2745
2746
2747
# File 'lib/stripe/resources/checkout/session.rb', line 2745

def redirect_on_completion
  @redirect_on_completion
end

#return_urlObject (readonly)

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.



2747
2748
2749
# File 'lib/stripe/resources/checkout/session.rb', line 2747

def return_url
  @return_url
end

#saved_payment_method_optionsObject (readonly)

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



2749
2750
2751
# File 'lib/stripe/resources/checkout/session.rb', line 2749

def saved_payment_method_options
  @saved_payment_method_options
end

#setup_intentObject (readonly)

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](docs.stripe.com/api/checkout/sessions/expire) instead.



2751
2752
2753
# File 'lib/stripe/resources/checkout/session.rb', line 2751

def setup_intent
  @setup_intent
end

#shipping_address_collectionObject (readonly)

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



2753
2754
2755
# File 'lib/stripe/resources/checkout/session.rb', line 2753

def shipping_address_collection
  @shipping_address_collection
end

#shipping_costObject (readonly)

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



2755
2756
2757
# File 'lib/stripe/resources/checkout/session.rb', line 2755

def shipping_cost
  @shipping_cost
end

#shipping_optionsObject (readonly)

The shipping rate options applied to this Session.



2757
2758
2759
# File 'lib/stripe/resources/checkout/session.rb', line 2757

def shipping_options
  @shipping_options
end

#statusObject (readonly)

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



2759
2760
2761
# File 'lib/stripe/resources/checkout/session.rb', line 2759

def status
  @status
end

#submit_typeObject (readonly)

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.



2763
2764
2765
# File 'lib/stripe/resources/checkout/session.rb', line 2763

def submit_type
  @submit_type
end

#subscriptionObject (readonly)

The ID of the [Subscription](docs.stripe.com/api/subscriptions) for Checkout Sessions in ‘subscription` mode.



2765
2766
2767
# File 'lib/stripe/resources/checkout/session.rb', line 2765

def subscription
  @subscription
end

#success_urlObject (readonly)

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



2768
2769
2770
# File 'lib/stripe/resources/checkout/session.rb', line 2768

def success_url
  @success_url
end

#tax_id_collectionObject (readonly)

Attribute for field tax_id_collection



2770
2771
2772
# File 'lib/stripe/resources/checkout/session.rb', line 2770

def tax_id_collection
  @tax_id_collection
end

#total_detailsObject (readonly)

Tax and discount details for the computed total amount.



2772
2773
2774
# File 'lib/stripe/resources/checkout/session.rb', line 2772

def total_details
  @total_details
end

#ui_modeObject (readonly)

The UI mode of the Session. Defaults to ‘hosted_page`.



2774
2775
2776
# File 'lib/stripe/resources/checkout/session.rb', line 2774

def ui_mode
  @ui_mode
end

#urlObject (readonly)

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](docs.stripe.com/payments/checkout/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.



2777
2778
2779
# File 'lib/stripe/resources/checkout/session.rb', line 2777

def url
  @url
end

#wallet_optionsObject (readonly)

Wallet-specific configuration for this Checkout Session.



2779
2780
2781
# File 'lib/stripe/resources/checkout/session.rb', line 2779

def wallet_options
  @wallet_options
end

Class Method Details

.approve(session, params = {}, opts = {}) ⇒ Object

Approves a customer’s attempt to pay for a Checkout Session with approval_method set to manual.



2794
2795
2796
2797
2798
2799
2800
2801
# File 'lib/stripe/resources/checkout/session.rb', line 2794

def self.approve(session, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/checkout/sessions/%<session>s/approve", { session: CGI.escape(session) }),
    params: params,
    opts: opts
  )
end

.create(params = {}, opts = {}) ⇒ Object

Creates a Checkout Session object.



2804
2805
2806
2807
2808
2809
2810
2811
# File 'lib/stripe/resources/checkout/session.rb', line 2804

def self.create(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "/v1/checkout/sessions",
    params: params,
    opts: opts
  )
end

.expire(session, params = {}, opts = {}) ⇒ Object

A Checkout Session can be expired when it is in one of these statuses: open

After it expires, a customer can’t complete a Checkout Session and customers loading the Checkout Session see a message saying the Checkout Session is expired.



2828
2829
2830
2831
2832
2833
2834
2835
# File 'lib/stripe/resources/checkout/session.rb', line 2828

def self.expire(session, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/checkout/sessions/%<session>s/expire", { session: CGI.escape(session) }),
    params: params,
    opts: opts
  )
end

.field_encodingsObject



2918
2919
2920
2921
2922
# File 'lib/stripe/resources/checkout/session.rb', line 2918

def self.field_encodings
  @field_encodings = {
    currency_conversion: { kind: :object, fields: { fx_rate: :decimal_string } },
  }
end

.field_remappingsObject



2914
2915
2916
# File 'lib/stripe/resources/checkout/session.rb', line 2914

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
# File 'lib/stripe/resources/checkout/session.rb', line 2879

def self.inner_class_types
  @inner_class_types = {
    adaptive_pricing: AdaptivePricing,
    after_expiration: AfterExpiration,
    automatic_tax: AutomaticTax,
    branding_settings: BrandingSettings,
    collected_information: CollectedInformation,
    consent: Consent,
    consent_collection: ConsentCollection,
    currency_conversion: CurrencyConversion,
    current_attempt: CurrentAttempt,
    custom_fields: CustomField,
    custom_text: CustomText,
    customer_details: CustomerDetails,
    discounts: Discount,
    invoice_creation: InvoiceCreation,
    managed_payments: ManagedPayments,
    name_collection: NameCollection,
    optional_items: OptionalItem,
    payment_method_configuration_details: PaymentMethodConfigurationDetails,
    payment_method_options: PaymentMethodOptions,
    permissions: Permissions,
    phone_number_collection: PhoneNumberCollection,
    presentment_details: PresentmentDetails,
    saved_payment_method_options: SavedPaymentMethodOptions,
    shipping_address_collection: ShippingAddressCollection,
    shipping_cost: ShippingCost,
    shipping_options: ShippingOption,
    tax_id_collection: TaxIdCollection,
    total_details: TotalDetails,
    wallet_options: WalletOptions,
    checkout_items: CheckoutItem,
  }
end

.list(params = {}, opts = {}) ⇒ Object

Returns a list of Checkout Sessions.



2838
2839
2840
2841
2842
2843
2844
2845
# File 'lib/stripe/resources/checkout/session.rb', line 2838

def self.list(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/checkout/sessions",
    params: params,
    opts: opts
  )
end

.list_line_items(session, params = {}, opts = {}) ⇒ Object

When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.



2858
2859
2860
2861
2862
2863
2864
2865
# File 'lib/stripe/resources/checkout/session.rb', line 2858

def self.list_line_items(session, params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(session) }),
    params: params,
    opts: opts
  )
end

.object_nameObject



26
27
28
# File 'lib/stripe/resources/checkout/session.rb', line 26

def self.object_name
  "checkout.session"
end

.update(session, params = {}, opts = {}) ⇒ Object

Updates a Checkout Session object.

Related guide: [Dynamically update a Checkout Session](docs.stripe.com/payments/advanced/dynamic-updates)



2870
2871
2872
2873
2874
2875
2876
2877
# File 'lib/stripe/resources/checkout/session.rb', line 2870

def self.update(session, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/checkout/sessions/%<session>s", { session: CGI.escape(session) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

#approve(params = {}, opts = {}) ⇒ Object

Approves a customer’s attempt to pay for a Checkout Session with approval_method set to manual.



2784
2785
2786
2787
2788
2789
2790
2791
# File 'lib/stripe/resources/checkout/session.rb', line 2784

def approve(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/checkout/sessions/%<session>s/approve", { session: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#expire(params = {}, opts = {}) ⇒ Object

A Checkout Session can be expired when it is in one of these statuses: open

After it expires, a customer can’t complete a Checkout Session and customers loading the Checkout Session see a message saying the Checkout Session is expired.



2816
2817
2818
2819
2820
2821
2822
2823
# File 'lib/stripe/resources/checkout/session.rb', line 2816

def expire(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/checkout/sessions/%<session>s/expire", { session: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#list_line_items(params = {}, opts = {}) ⇒ Object

When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.



2848
2849
2850
2851
2852
2853
2854
2855
# File 'lib/stripe/resources/checkout/session.rb', line 2848

def list_line_items(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end