mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-03 00:01:21 -04:00
64 lines
2.2 KiB
Ruby
64 lines
2.2 KiB
Ruby
# File generated from our OpenAPI spec
|
|
# frozen_string_literal: true
|
|
|
|
module Stripe
|
|
module Checkout
|
|
# A Checkout Session represents your customer's session as they pay for
|
|
# one-time purchases or subscriptions through [Checkout](https://stripe.com/docs/payments/checkout)
|
|
# or [Payment Links](https://stripe.com/docs/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](https://stripe.com/docs/api/customers), and either the successful
|
|
# [PaymentIntent](https://stripe.com/docs/api/payment_intents) or an active
|
|
# [Subscription](https://stripe.com/docs/api/subscriptions).
|
|
#
|
|
# You can create a Checkout Session on your server and pass its ID to the
|
|
# client to begin Checkout.
|
|
#
|
|
# Related guide: [Checkout Quickstart](https://stripe.com/docs/checkout/quickstart).
|
|
class Session < APIResource
|
|
extend Stripe::APIOperations::Create
|
|
extend Stripe::APIOperations::List
|
|
|
|
OBJECT_NAME = "checkout.session"
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
end
|
|
end
|
|
end
|