Sha256: 79e65c97dcf4edc3152271d5aeceb6996eb010c2084057bb9dc89d19d07452ac

Contents?: true

Size: 1.97 KB

Versions: 13

Compression:

Stored size: 1.97 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  module Checkout
    class SessionService < StripeService
      attr_reader :line_items

      def initialize(requestor)
        super(requestor)
        @line_items = Stripe::Checkout::SessionLineItemService.new(@requestor)
      end

      # Creates a Session object.
      def create(params = {}, opts = {})
        request(
          method: :post,
          path: "/v1/checkout/sessions",
          params: params,
          opts: opts,
          base_address: :api
        )
      end

      # A Session can be expired when it is in one of these statuses: open
      #
      # After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired.
      def expire(session, params = {}, opts = {})
        request(
          method: :post,
          path: format("/v1/checkout/sessions/%<session>s/expire", { session: CGI.escape(session) }),
          params: params,
          opts: opts,
          base_address: :api
        )
      end

      # Returns a list of Checkout Sessions.
      def list(params = {}, opts = {})
        request(
          method: :get,
          path: "/v1/checkout/sessions",
          params: params,
          opts: opts,
          base_address: :api
        )
      end

      # Retrieves a Session object.
      def retrieve(session, params = {}, opts = {})
        request(
          method: :get,
          path: format("/v1/checkout/sessions/%<session>s", { session: CGI.escape(session) }),
          params: params,
          opts: opts,
          base_address: :api
        )
      end

      # Updates a Session object.
      def update(session, params = {}, opts = {})
        request(
          method: :post,
          path: format("/v1/checkout/sessions/%<session>s", { session: CGI.escape(session) }),
          params: params,
          opts: opts,
          base_address: :api
        )
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
stripe-13.3.0.pre.beta.1 lib/stripe/services/checkout/session_service.rb
stripe-13.2.0 lib/stripe/services/checkout/session_service.rb
stripe-13.1.2 lib/stripe/services/checkout/session_service.rb
stripe-13.2.0.pre.beta.3 lib/stripe/services/checkout/session_service.rb
stripe-13.2.0.pre.beta.2 lib/stripe/services/checkout/session_service.rb
stripe-13.1.1 lib/stripe/services/checkout/session_service.rb
stripe-13.2.0.pre.beta.1 lib/stripe/services/checkout/session_service.rb
stripe-13.1.0 lib/stripe/services/checkout/session_service.rb
stripe-13.0.2 lib/stripe/services/checkout/session_service.rb
stripe-13.1.0.pre.beta.3 lib/stripe/services/checkout/session_service.rb
stripe-13.0.1 lib/stripe/services/checkout/session_service.rb
stripe-13.1.0.pre.beta.2 lib/stripe/services/checkout/session_service.rb
stripe-13.0.0 lib/stripe/services/checkout/session_service.rb