Class: Stripe::Checkout::SessionService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::Checkout::SessionService
- Defined in:
- lib/stripe/services/checkout/session_service.rb
Defined Under Namespace
Classes: CreateParams, ExpireParams, ListParams, RetrieveParams, UpdateParams
Instance Attribute Summary collapse
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Creates a Session object.
-
#expire(session, params = {}, opts = {}) ⇒ Object
A Session can be expired when it is in one of these statuses: open.
-
#initialize(requestor) ⇒ SessionService
constructor
A new instance of SessionService.
-
#list(params = {}, opts = {}) ⇒ Object
Returns a list of Checkout Sessions.
-
#retrieve(session, params = {}, opts = {}) ⇒ Object
Retrieves a Session object.
-
#update(session, params = {}, opts = {}) ⇒ Object
Updates a Session object.
Methods inherited from StripeService
Constructor Details
#initialize(requestor) ⇒ SessionService
Returns a new instance of SessionService.
9 10 11 12 |
# File 'lib/stripe/services/checkout/session_service.rb', line 9 def initialize(requestor) super(requestor) @line_items = Stripe::Checkout::SessionLineItemService.new(@requestor) end |
Instance Attribute Details
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
7 8 9 |
# File 'lib/stripe/services/checkout/session_service.rb', line 7 def line_items @line_items end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Object
Creates a Session object.
2517 2518 2519 2520 2521 2522 2523 2524 2525 |
# File 'lib/stripe/services/checkout/session_service.rb', line 2517 def create(params = {}, opts = {}) request( method: :post, path: "/v1/checkout/sessions", params: params, opts: opts, base_address: :api ) end |
#expire(session, params = {}, opts = {}) ⇒ Object
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.
2530 2531 2532 2533 2534 2535 2536 2537 2538 |
# File 'lib/stripe/services/checkout/session_service.rb', line 2530 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 |
#list(params = {}, opts = {}) ⇒ Object
Returns a list of Checkout Sessions.
2541 2542 2543 2544 2545 2546 2547 2548 2549 |
# File 'lib/stripe/services/checkout/session_service.rb', line 2541 def list(params = {}, opts = {}) request( method: :get, path: "/v1/checkout/sessions", params: params, opts: opts, base_address: :api ) end |
#retrieve(session, params = {}, opts = {}) ⇒ Object
Retrieves a Session object.
2552 2553 2554 2555 2556 2557 2558 2559 2560 |
# File 'lib/stripe/services/checkout/session_service.rb', line 2552 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 |
#update(session, params = {}, opts = {}) ⇒ Object
Updates a Session object.
2563 2564 2565 2566 2567 2568 2569 2570 2571 |
# File 'lib/stripe/services/checkout/session_service.rb', line 2563 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 |