Class: Stripe::Order
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Order
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/order.rb
Overview
An Order describes a purchase being made by a customer, including the products & quantities being purchased, the order status, the payment information, and the billing/shipping details.
Related guide: [Orders overview](stripe.com/docs/orders)
Constant Summary collapse
- OBJECT_NAME =
"order"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.cancel(id, params = {}, opts = {}) ⇒ Object
Cancels the order as well as the payment intent if one is attached.
-
.create(params = {}, opts = {}) ⇒ Object
Creates a new open order object.
-
.list(filters = {}, opts = {}) ⇒ Object
Returns a list of your orders.
-
.list_line_items(id, params = {}, opts = {}) ⇒ Object
When retrieving an order, there is an includable line_items property containing the first handful of those items.
- .object_name ⇒ Object
-
.reopen(id, params = {}, opts = {}) ⇒ Object
Reopens a submitted 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.
Instance Method Summary collapse
-
#cancel(params = {}, opts = {}) ⇒ Object
Cancels the order as well as the payment intent if one is attached.
-
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving an order, there is an includable line_items property containing the first handful of those items.
-
#reopen(params = {}, opts = {}) ⇒ Object
Reopens a submitted order.
-
#submit(params = {}, opts = {}) ⇒ Object
Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Class Method Details
.cancel(id, params = {}, opts = {}) ⇒ Object
Cancels the order as well as the payment intent if one is attached.
31 32 33 34 35 36 37 38 |
# File 'lib/stripe/resources/order.rb', line 31 def self.cancel(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
Creates a new open order object.
41 42 43 |
# File 'lib/stripe/resources/order.rb', line 41 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/orders", params: params, opts: opts) end |
.list(filters = {}, opts = {}) ⇒ Object
Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
46 47 48 |
# File 'lib/stripe/resources/order.rb', line 46 def self.list(filters = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/orders", params: filters, opts: opts) end |
.list_line_items(id, params = {}, opts = {}) ⇒ Object
When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
61 62 63 64 65 66 67 68 |
# File 'lib/stripe/resources/order.rb', line 61 def self.list_line_items(id, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.object_name ⇒ Object
16 17 18 |
# File 'lib/stripe/resources/order.rb', line 16 def self.object_name "order" end |
.reopen(id, params = {}, opts = {}) ⇒ Object
Reopens a submitted order.
81 82 83 84 85 86 87 88 |
# File 'lib/stripe/resources/order.rb', line 81 def self.reopen(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(id) }), params: params, opts: opts ) 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](stripe.com/docs/api#reopen_order) method is called.
101 102 103 104 105 106 107 108 |
# File 'lib/stripe/resources/order.rb', line 101 def self.submit(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(id) }), params: params, opts: opts ) 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.
111 112 113 114 115 116 117 118 |
# File 'lib/stripe/resources/order.rb', line 111 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
Instance Method Details
#cancel(params = {}, opts = {}) ⇒ Object
Cancels the order as well as the payment intent if one is attached.
21 22 23 24 25 26 27 28 |
# File 'lib/stripe/resources/order.rb', line 21 def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
51 52 53 54 55 56 57 58 |
# File 'lib/stripe/resources/order.rb', line 51 def list_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#reopen(params = {}, opts = {}) ⇒ Object
Reopens a submitted order.
71 72 73 74 75 76 77 78 |
# File 'lib/stripe/resources/order.rb', line 71 def reopen(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#submit(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](stripe.com/docs/api#reopen_order) method is called.
91 92 93 94 95 96 97 98 |
# File 'lib/stripe/resources/order.rb', line 91 def submit(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |