Class: Stripe::CustomerSessionService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::CustomerSessionService
- Defined in:
- lib/stripe/services/customer_session_service.rb
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
-
#serialize_batch_create(params = {}, opts = {}) ⇒ Object
Serializes a CustomerSession create request into a batch job JSONL line.
Methods inherited from StripeService
#initialize, #request, #request_stream
Constructor Details
This class inherits a constructor from Stripe::StripeService
Instance Method Details
#create(params = {}, opts = {}) ⇒ Object
Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
7 8 9 10 11 12 13 14 15 |
# File 'lib/stripe/services/customer_session_service.rb', line 7 def create(params = {}, opts = {}) request( method: :post, path: "/v1/customer_sessions", params: params, opts: opts, base_address: :api ) end |
#serialize_batch_create(params = {}, opts = {}) ⇒ Object
Serializes a CustomerSession create request into a batch job JSONL line.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/stripe/services/customer_session_service.rb', line 18 def serialize_batch_create(params = {}, opts = {}) request_id = SecureRandom.uuid stripe_version = opts[:stripe_version] || Stripe.api_version request_body = { id: request_id, params: params, stripe_version: stripe_version, } request_body[:context] = opts[:stripe_context] if opts[:stripe_context] JSON.generate(request_body) end |