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

Defined Under Namespace

Classes: AdaptivePricing, AfterExpiration, AutomaticSurcharge, AutomaticTax, BrandingSettings, CheckoutItem, CollectedInformation, Consent, ConsentCollection, CurrencyConversion, CurrentAttempt, CustomField, CustomText, CustomerDetails, Discount, InvoiceCreation, Item, ManagedPayments, NameCollection, OptionalItem, PaymentMethodConfigurationDetails, PaymentMethodOptions, Permissions, PhoneNumberCollection, PresentmentDetails, Redaction, SavedPaymentMethodOptions, ShippingAddressCollection, ShippingCost, ShippingOption, SurchargeCost, 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.



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

def adaptive_pricing
  @adaptive_pricing
end

#after_expirationObject (readonly)

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



2921
2922
2923
# File 'lib/stripe/resources/checkout/session.rb', line 2921

def after_expiration
  @after_expiration
end

#allow_promotion_codesObject (readonly)

Enables user redeemable promotion codes.



2923
2924
2925
# File 'lib/stripe/resources/checkout/session.rb', line 2923

def allow_promotion_codes
  @allow_promotion_codes
end

#amount_subtotalObject (readonly)

Total of all items before discounts or taxes are applied.



2925
2926
2927
# File 'lib/stripe/resources/checkout/session.rb', line 2925

def amount_subtotal
  @amount_subtotal
end

#amount_totalObject (readonly)

Total of all items after discounts and taxes are applied.



2927
2928
2929
# File 'lib/stripe/resources/checkout/session.rb', line 2927

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 from your server.



2933
2934
2935
# File 'lib/stripe/resources/checkout/session.rb', line 2933

def approval_method
  @approval_method
end

#automatic_surchargeObject (readonly)

Attribute for field automatic_surcharge



2935
2936
2937
# File 'lib/stripe/resources/checkout/session.rb', line 2935

def automatic_surcharge
  @automatic_surcharge
end

#automatic_taxObject (readonly)

Attribute for field automatic_tax



2937
2938
2939
# File 'lib/stripe/resources/checkout/session.rb', line 2937

def automatic_tax
  @automatic_tax
end

#billing_address_collectionObject (readonly)

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



2939
2940
2941
# File 'lib/stripe/resources/checkout/session.rb', line 2939

def billing_address_collection
  @billing_address_collection
end

#branding_settingsObject (readonly)

Attribute for field branding_settings



2941
2942
2943
# File 'lib/stripe/resources/checkout/session.rb', line 2941

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.



2943
2944
2945
# File 'lib/stripe/resources/checkout/session.rb', line 2943

def cancel_url
  @cancel_url
end

#checkout_itemsObject (readonly)

Attribute for field checkout_items



2945
2946
2947
# File 'lib/stripe/resources/checkout/session.rb', line 2945

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.



2949
2950
2951
# File 'lib/stripe/resources/checkout/session.rb', line 2949

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_page or ui_mode: elements. For ui_mode: embedded_page, the client secret is to be used when initializing Stripe.js embedded checkout. For ui_mode: elements, use the client secret with initCheckout on your front end.



2952
2953
2954
# File 'lib/stripe/resources/checkout/session.rb', line 2952

def client_secret
  @client_secret
end

#collected_informationObject (readonly)

Information about the customer collected within the Checkout Session.



2954
2955
2956
# File 'lib/stripe/resources/checkout/session.rb', line 2954

def collected_information
  @collected_information
end

Results of consent_collection for this session.



2956
2957
2958
# File 'lib/stripe/resources/checkout/session.rb', line 2956

def consent
  @consent
end

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



2958
2959
2960
# File 'lib/stripe/resources/checkout/session.rb', line 2958

def consent_collection
  @consent_collection
end

#createdObject (readonly)

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



2960
2961
2962
# File 'lib/stripe/resources/checkout/session.rb', line 2960

def created
  @created
end

#currencyObject (readonly)

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



2962
2963
2964
# File 'lib/stripe/resources/checkout/session.rb', line 2962

def currency
  @currency
end

#currency_conversionObject (readonly)

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



2964
2965
2966
# File 'lib/stripe/resources/checkout/session.rb', line 2964

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.



2966
2967
2968
# File 'lib/stripe/resources/checkout/session.rb', line 2966

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.



2968
2969
2970
# File 'lib/stripe/resources/checkout/session.rb', line 2968

def custom_fields
  @custom_fields
end

#custom_payment_method_typesObject (readonly)

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



2971
2972
2973
# File 'lib/stripe/resources/checkout/session.rb', line 2971

def custom_payment_method_types
  @custom_payment_method_types
end

#custom_textObject (readonly)

Attribute for field custom_text



2973
2974
2975
# File 'lib/stripe/resources/checkout/session.rb', line 2973

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.



2979
2980
2981
# File 'lib/stripe/resources/checkout/session.rb', line 2979

def customer
  @customer
end

#customer_accountObject (readonly)

The ID of the account for this Session.



2981
2982
2983
# File 'lib/stripe/resources/checkout/session.rb', line 2981

def 
  @customer_account
end

#customer_creationObject (readonly)

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



2983
2984
2985
# File 'lib/stripe/resources/checkout/session.rb', line 2983

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.



2985
2986
2987
# File 'lib/stripe/resources/checkout/session.rb', line 2985

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.



2991
2992
2993
# File 'lib/stripe/resources/checkout/session.rb', line 2991

def customer_email
  @customer_email
end

#discountsObject (readonly)

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



2993
2994
2995
# File 'lib/stripe/resources/checkout/session.rb', line 2993

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.



2995
2996
2997
# File 'lib/stripe/resources/checkout/session.rb', line 2995

def excluded_payment_method_types
  @excluded_payment_method_types
end

#expires_atObject (readonly)

The timestamp at which the Checkout Session will expire.



2997
2998
2999
# File 'lib/stripe/resources/checkout/session.rb', line 2997

def expires_at
  @expires_at
end

#idObject (readonly)

Unique identifier for the object.



2999
3000
3001
# File 'lib/stripe/resources/checkout/session.rb', line 2999

def id
  @id
end

#integration_identifierObject (readonly)

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



3001
3002
3003
# File 'lib/stripe/resources/checkout/session.rb', line 3001

def integration_identifier
  @integration_identifier
end

#invoiceObject (readonly)

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



3003
3004
3005
# File 'lib/stripe/resources/checkout/session.rb', line 3003

def invoice
  @invoice
end

#invoice_creationObject (readonly)

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



3005
3006
3007
# File 'lib/stripe/resources/checkout/session.rb', line 3005

def invoice_creation
  @invoice_creation
end

#itemsObject (readonly)

The items to be purchased by the customer.



3007
3008
3009
# File 'lib/stripe/resources/checkout/session.rb', line 3007

def items
  @items
end

#line_itemsObject (readonly)

The line items purchased by the customer.



3009
3010
3011
# File 'lib/stripe/resources/checkout/session.rb', line 3009

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.



3011
3012
3013
# File 'lib/stripe/resources/checkout/session.rb', line 3011

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.



3013
3014
3015
# File 'lib/stripe/resources/checkout/session.rb', line 3013

def locale
  @locale
end

#managed_paymentsObject (readonly)

Settings for Managed Payments for this Checkout Session and resulting PaymentIntents, Invoices, and Subscriptions.



3015
3016
3017
# File 'lib/stripe/resources/checkout/session.rb', line 3015

def managed_payments
  @managed_payments
end

#metadataObject (readonly)

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.



3017
3018
3019
# File 'lib/stripe/resources/checkout/session.rb', line 3017

def 
  @metadata
end

#modeObject (readonly)

The mode of the Checkout Session.



3019
3020
3021
# File 'lib/stripe/resources/checkout/session.rb', line 3019

def mode
  @mode
end

#name_collectionObject (readonly)

Attribute for field name_collection



3021
3022
3023
# File 'lib/stripe/resources/checkout/session.rb', line 3021

def name_collection
  @name_collection
end

#objectObject (readonly)

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



3023
3024
3025
# File 'lib/stripe/resources/checkout/session.rb', line 3023

def object
  @object
end

#optional_itemsObject (readonly)

The optional items presented to the customer at checkout.



3025
3026
3027
# File 'lib/stripe/resources/checkout/session.rb', line 3025

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.



3027
3028
3029
# File 'lib/stripe/resources/checkout/session.rb', line 3027

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



3029
3030
3031
# File 'lib/stripe/resources/checkout/session.rb', line 3029

def payment_intent
  @payment_intent
end

The ID of the Payment Link that created this Session.



3031
3032
3033
# File 'lib/stripe/resources/checkout/session.rb', line 3031

def payment_link
  @payment_link
end

#payment_method_collectionObject (readonly)

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



3033
3034
3035
# File 'lib/stripe/resources/checkout/session.rb', line 3033

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.



3035
3036
3037
# File 'lib/stripe/resources/checkout/session.rb', line 3035

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.



3037
3038
3039
# File 'lib/stripe/resources/checkout/session.rb', line 3037

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.



3040
3041
3042
# File 'lib/stripe/resources/checkout/session.rb', line 3040

def payment_method_types
  @payment_method_types
end

#payment_recordObject (readonly)

The Payment Record for this Checkout Session.



3042
3043
3044
# File 'lib/stripe/resources/checkout/session.rb', line 3042

def payment_record
  @payment_record
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.



3045
3046
3047
# File 'lib/stripe/resources/checkout/session.rb', line 3045

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.



3049
3050
3051
# File 'lib/stripe/resources/checkout/session.rb', line 3049

def permissions
  @permissions
end

#phone_number_collectionObject (readonly)

Attribute for field phone_number_collection



3051
3052
3053
# File 'lib/stripe/resources/checkout/session.rb', line 3051

def phone_number_collection
  @phone_number_collection
end

#presentment_detailsObject (readonly)

Attribute for field presentment_details



3053
3054
3055
# File 'lib/stripe/resources/checkout/session.rb', line 3053

def presentment_details
  @presentment_details
end

#recovered_fromObject (readonly)

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



3055
3056
3057
# File 'lib/stripe/resources/checkout/session.rb', line 3055

def recovered_from
  @recovered_from
end

#redactionObject (readonly)

The redaction status of the Checkout Session. If the Session is not redacted, this field is null.



3057
3058
3059
# File 'lib/stripe/resources/checkout/session.rb', line 3057

def redaction
  @redaction
end

#redirect_on_completionObject (readonly)

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



3059
3060
3061
# File 'lib/stripe/resources/checkout/session.rb', line 3059

def redirect_on_completion
  @redirect_on_completion
end

#return_urlObject (readonly)

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



3061
3062
3063
# File 'lib/stripe/resources/checkout/session.rb', line 3061

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.



3063
3064
3065
# File 'lib/stripe/resources/checkout/session.rb', line 3063

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



3065
3066
3067
# File 'lib/stripe/resources/checkout/session.rb', line 3065

def setup_intent
  @setup_intent
end

#shipping_address_collectionObject (readonly)

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



3067
3068
3069
# File 'lib/stripe/resources/checkout/session.rb', line 3067

def shipping_address_collection
  @shipping_address_collection
end

#shipping_costObject (readonly)

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



3069
3070
3071
# File 'lib/stripe/resources/checkout/session.rb', line 3069

def shipping_cost
  @shipping_cost
end

#shipping_optionsObject (readonly)

The shipping rate options applied to this Session.



3071
3072
3073
# File 'lib/stripe/resources/checkout/session.rb', line 3071

def shipping_options
  @shipping_options
end

#statusObject (readonly)

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



3073
3074
3075
# File 'lib/stripe/resources/checkout/session.rb', line 3073

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.



3077
3078
3079
# File 'lib/stripe/resources/checkout/session.rb', line 3077

def submit_type
  @submit_type
end

#subscriptionObject (readonly)

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



3079
3080
3081
# File 'lib/stripe/resources/checkout/session.rb', line 3079

def subscription
  @subscription
end

#success_urlObject (readonly)

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



3082
3083
3084
# File 'lib/stripe/resources/checkout/session.rb', line 3082

def success_url
  @success_url
end

#surcharge_costObject (readonly)

Attribute for field surcharge_cost



3084
3085
3086
# File 'lib/stripe/resources/checkout/session.rb', line 3084

def surcharge_cost
  @surcharge_cost
end

#tax_id_collectionObject (readonly)

Attribute for field tax_id_collection



3086
3087
3088
# File 'lib/stripe/resources/checkout/session.rb', line 3086

def tax_id_collection
  @tax_id_collection
end

#total_detailsObject (readonly)

Tax and discount details for the computed total amount.



3088
3089
3090
# File 'lib/stripe/resources/checkout/session.rb', line 3088

def total_details
  @total_details
end

#ui_modeObject (readonly)

The UI mode of the Session. Defaults to hosted_page.



3090
3091
3092
# File 'lib/stripe/resources/checkout/session.rb', line 3090

def ui_mode
  @ui_mode
end

#urlObject (readonly)

The URL to the Checkout Session. Applies to Checkout Sessions with ui_mode: hosted_page. 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.



3093
3094
3095
# File 'lib/stripe/resources/checkout/session.rb', line 3093

def url
  @url
end

#wallet_optionsObject (readonly)

Wallet-specific configuration for this Checkout Session.



3095
3096
3097
# File 'lib/stripe/resources/checkout/session.rb', line 3095

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.



3108
3109
3110
3111
3112
3113
3114
3115
# File 'lib/stripe/resources/checkout/session.rb', line 3108

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.



3118
3119
3120
3121
3122
3123
3124
3125
# File 'lib/stripe/resources/checkout/session.rb', line 3118

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.



3142
3143
3144
3145
3146
3147
3148
3149
# File 'lib/stripe/resources/checkout/session.rb', line 3142

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



3236
3237
3238
3239
3240
# File 'lib/stripe/resources/checkout/session.rb', line 3236

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

.field_remappingsObject



3232
3233
3234
# File 'lib/stripe/resources/checkout/session.rb', line 3232

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
# File 'lib/stripe/resources/checkout/session.rb', line 3193

def self.inner_class_types
  @inner_class_types = {
    adaptive_pricing: AdaptivePricing,
    after_expiration: AfterExpiration,
    automatic_surcharge: AutomaticSurcharge,
    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,
    items: Item,
    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,
    redaction: Redaction,
    saved_payment_method_options: SavedPaymentMethodOptions,
    shipping_address_collection: ShippingAddressCollection,
    shipping_cost: ShippingCost,
    shipping_options: ShippingOption,
    surcharge_cost: SurchargeCost,
    tax_id_collection: TaxIdCollection,
    total_details: TotalDetails,
    wallet_options: WalletOptions,
    checkout_items: CheckoutItem,
  }
end

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

Returns a list of Checkout Sessions.



3152
3153
3154
3155
3156
3157
3158
3159
# File 'lib/stripe/resources/checkout/session.rb', line 3152

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.



3172
3173
3174
3175
3176
3177
3178
3179
# File 'lib/stripe/resources/checkout/session.rb', line 3172

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



3184
3185
3186
3187
3188
3189
3190
3191
# File 'lib/stripe/resources/checkout/session.rb', line 3184

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.



3098
3099
3100
3101
3102
3103
3104
3105
# File 'lib/stripe/resources/checkout/session.rb', line 3098

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.



3130
3131
3132
3133
3134
3135
3136
3137
# File 'lib/stripe/resources/checkout/session.rb', line 3130

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.



3162
3163
3164
3165
3166
3167
3168
3169
# File 'lib/stripe/resources/checkout/session.rb', line 3162

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