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)
Defined Under Namespace
Classes: AutomaticTax, BillingDetails, CancelParams, CreateParams, Credit, ListLineItemsParams, ListParams, Payment, ReopenParams, ShippingCost, ShippingDetails, SubmitParams, TaxDetails, TotalDetails, UpdateParams
Constant Summary collapse
- OBJECT_NAME =
"order"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount_remaining ⇒ Object
readonly
Attribute for field amount_remaining.
-
#amount_subtotal ⇒ Object
readonly
Order cost before any discounts or taxes are applied.
-
#amount_total ⇒ Object
readonly
Total order cost after discounts and taxes are applied.
-
#application ⇒ Object
readonly
ID of the Connect application that created the Order, if any.
-
#automatic_tax ⇒ Object
readonly
Attribute for field automatic_tax.
-
#billing_details ⇒ Object
readonly
Customer billing details associated with the order.
-
#client_secret ⇒ Object
readonly
The client secret of this Order.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#credits ⇒ Object
readonly
The credits applied to the Order.
-
#currency ⇒ Object
readonly
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#customer ⇒ Object
readonly
The customer which this orders belongs to.
-
#description ⇒ Object
readonly
An arbitrary string attached to the object.
-
#discounts ⇒ Object
readonly
The discounts applied to the order.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#ip_address ⇒ Object
readonly
A recent IP address of the purchaser used for tax reporting and tax location inference.
-
#line_items ⇒ Object
readonly
A list of line items the customer is ordering.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#payment ⇒ Object
readonly
Attribute for field payment.
-
#shipping_cost ⇒ Object
readonly
The details of the customer cost of shipping, including the customer chosen ShippingRate.
-
#shipping_details ⇒ Object
readonly
Customer shipping information associated with the order.
-
#status ⇒ Object
readonly
The overall status of the order.
-
#tax_details ⇒ Object
readonly
Attribute for field tax_details.
-
#total_details ⇒ Object
readonly
Attribute for field total_details.
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(params = {}, 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
Instance Attribute Details
#amount_remaining ⇒ Object (readonly)
Attribute for field amount_remaining
2705 2706 2707 |
# File 'lib/stripe/resources/order.rb', line 2705 def amount_remaining @amount_remaining end |
#amount_subtotal ⇒ Object (readonly)
Order cost before any discounts or taxes are applied. A positive integer representing the subtotal of the order in the [smallest currency unit](stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency).
2707 2708 2709 |
# File 'lib/stripe/resources/order.rb', line 2707 def amount_subtotal @amount_subtotal end |
#amount_total ⇒ Object (readonly)
Total order cost after discounts and taxes are applied. A positive integer representing the cost of the order in the [smallest currency unit](stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). To submit an order, the total must be either 0 or at least $0.50 USD or [equivalent in charge currency](stripe.com/docs/currencies#minimum-and-maximum-charge-amounts).
2709 2710 2711 |
# File 'lib/stripe/resources/order.rb', line 2709 def amount_total @amount_total end |
#application ⇒ Object (readonly)
ID of the Connect application that created the Order, if any.
2711 2712 2713 |
# File 'lib/stripe/resources/order.rb', line 2711 def application @application end |
#automatic_tax ⇒ Object (readonly)
Attribute for field automatic_tax
2713 2714 2715 |
# File 'lib/stripe/resources/order.rb', line 2713 def automatic_tax @automatic_tax end |
#billing_details ⇒ Object (readonly)
Customer billing details associated with the order.
2715 2716 2717 |
# File 'lib/stripe/resources/order.rb', line 2715 def billing_details @billing_details end |
#client_secret ⇒ Object (readonly)
The client secret of this Order. Used for client-side retrieval using a publishable key.
The client secret can be used to complete a payment for an Order from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.
Refer to our docs for [creating and processing an order](stripe.com/docs/orders-beta/create-and-process) to learn about how client_secret should be handled.
2721 2722 2723 |
# File 'lib/stripe/resources/order.rb', line 2721 def client_secret @client_secret end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
2723 2724 2725 |
# File 'lib/stripe/resources/order.rb', line 2723 def created @created end |
#credits ⇒ Object (readonly)
The credits applied to the Order. At most 10 credits can be applied to an Order.
2725 2726 2727 |
# File 'lib/stripe/resources/order.rb', line 2725 def credits @credits end |
#currency ⇒ Object (readonly)
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).
2727 2728 2729 |
# File 'lib/stripe/resources/order.rb', line 2727 def currency @currency end |
#customer ⇒ Object (readonly)
The customer which this orders belongs to.
2729 2730 2731 |
# File 'lib/stripe/resources/order.rb', line 2729 def customer @customer end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users.
2731 2732 2733 |
# File 'lib/stripe/resources/order.rb', line 2731 def description @description end |
#discounts ⇒ Object (readonly)
The discounts applied to the order. Use ‘expand[]=discounts` to expand each discount.
2733 2734 2735 |
# File 'lib/stripe/resources/order.rb', line 2733 def discounts @discounts end |
#id ⇒ Object (readonly)
Unique identifier for the object.
2735 2736 2737 |
# File 'lib/stripe/resources/order.rb', line 2735 def id @id end |
#ip_address ⇒ Object (readonly)
A recent IP address of the purchaser used for tax reporting and tax location inference.
2737 2738 2739 |
# File 'lib/stripe/resources/order.rb', line 2737 def ip_address @ip_address end |
#line_items ⇒ Object (readonly)
A list of line items the customer is ordering. Each line item includes information about the product, the quantity, and the resulting cost. There is a maximum of 100 line items.
2739 2740 2741 |
# File 'lib/stripe/resources/order.rb', line 2739 def line_items @line_items end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
2741 2742 2743 |
# File 'lib/stripe/resources/order.rb', line 2741 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
2743 2744 2745 |
# File 'lib/stripe/resources/order.rb', line 2743 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
2745 2746 2747 |
# File 'lib/stripe/resources/order.rb', line 2745 def object @object end |
#payment ⇒ Object (readonly)
Attribute for field payment
2747 2748 2749 |
# File 'lib/stripe/resources/order.rb', line 2747 def payment @payment end |
#shipping_cost ⇒ Object (readonly)
The details of the customer cost of shipping, including the customer chosen ShippingRate.
2749 2750 2751 |
# File 'lib/stripe/resources/order.rb', line 2749 def shipping_cost @shipping_cost end |
#shipping_details ⇒ Object (readonly)
Customer shipping information associated with the order.
2751 2752 2753 |
# File 'lib/stripe/resources/order.rb', line 2751 def shipping_details @shipping_details end |
#status ⇒ Object (readonly)
The overall status of the order.
2753 2754 2755 |
# File 'lib/stripe/resources/order.rb', line 2753 def status @status end |
#tax_details ⇒ Object (readonly)
Attribute for field tax_details
2755 2756 2757 |
# File 'lib/stripe/resources/order.rb', line 2755 def tax_details @tax_details end |
#total_details ⇒ Object (readonly)
Attribute for field total_details
2757 2758 2759 |
# File 'lib/stripe/resources/order.rb', line 2757 def total_details @total_details end |
Class Method Details
.cancel(id, params = {}, opts = {}) ⇒ Object
Cancels the order as well as the payment intent if one is attached.
2770 2771 2772 2773 2774 2775 2776 2777 |
# File 'lib/stripe/resources/order.rb', line 2770 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.
2780 2781 2782 |
# File 'lib/stripe/resources/order.rb', line 2780 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/orders", params: params, opts: opts) 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.
2785 2786 2787 |
# File 'lib/stripe/resources/order.rb', line 2785 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/orders", params: params, 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.
2800 2801 2802 2803 2804 2805 2806 2807 |
# File 'lib/stripe/resources/order.rb', line 2800 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.
2820 2821 2822 2823 2824 2825 2826 2827 |
# File 'lib/stripe/resources/order.rb', line 2820 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.
2840 2841 2842 2843 2844 2845 2846 2847 |
# File 'lib/stripe/resources/order.rb', line 2840 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.
2850 2851 2852 2853 2854 2855 2856 2857 |
# File 'lib/stripe/resources/order.rb', line 2850 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.
2760 2761 2762 2763 2764 2765 2766 2767 |
# File 'lib/stripe/resources/order.rb', line 2760 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.
2790 2791 2792 2793 2794 2795 2796 2797 |
# File 'lib/stripe/resources/order.rb', line 2790 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.
2810 2811 2812 2813 2814 2815 2816 2817 |
# File 'lib/stripe/resources/order.rb', line 2810 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.
2830 2831 2832 2833 2834 2835 2836 2837 |
# File 'lib/stripe/resources/order.rb', line 2830 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 |