Class: Stripe::OrderService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::OrderService
- Defined in:
- lib/stripe/services/order_service.rb
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Creates a new open order object.
-
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your orders.
-
#retrieve(id, params = {}, opts = {}) ⇒ Object
Retrieves the details of an existing order.
-
#submit(id, params = {}, opts = {}) ⇒ Object
Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid.
-
#update(id, params = {}, opts = {}) ⇒ Object
Updates the specific order by setting the values of the parameters passed.
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 new open order object.
7 8 9 10 11 |
# File 'lib/stripe/services/order_service.rb', line 7 def create(params = {}, opts = {}) params = ::Stripe::OrderCreateParams.coerce_params(params) unless params.is_a?(Stripe::RequestParams) request(method: :post, path: "/v1/orders", params: params, opts: opts, base_address: :api) end |
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
14 15 16 |
# File 'lib/stripe/services/order_service.rb', line 14 def list(params = {}, opts = {}) request(method: :get, path: "/v1/orders", params: params, opts: opts, base_address: :api) end |
#retrieve(id, params = {}, opts = {}) ⇒ Object
Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.
19 20 21 22 23 24 25 26 27 |
# File 'lib/stripe/services/order_service.rb', line 19 def retrieve(id, params = {}, opts = {}) request( method: :get, path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#submit(id, params = {}, opts = {}) ⇒ Object
Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the [reopen](docs.stripe.com/api#reopen_order) method is called.
30 31 32 33 34 35 36 37 38 |
# File 'lib/stripe/services/order_service.rb', line 30 def submit(id, params = {}, opts = {}) request( method: :post, path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#update(id, params = {}, opts = {}) ⇒ Object
Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/stripe/services/order_service.rb', line 41 def update(id, params = {}, opts = {}) params = ::Stripe::OrderUpdateParams.coerce_params(params) unless params.is_a?(Stripe::RequestParams) request( method: :post, path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |