Class: Stripe::Quote
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Quote
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/quote.rb
Overview
A Quote is a way to model prices that you’d like to provide to a customer. Once accepted, it will automatically create an invoice, subscription or subscription schedule.
Defined Under Namespace
Classes: AcceptParams, AutomaticTax, CancelParams, Computed, CreateParams, FinalizeQuoteParams, FromQuote, InvoiceSettings, ListComputedUpfrontLineItemsParams, ListLineItemsParams, ListParams, PdfParams, StatusTransitions, SubscriptionData, TotalDetails, TransferData, UpdateParams
Constant Summary collapse
- OBJECT_NAME =
"quote"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount_subtotal ⇒ Object
readonly
Total before any discounts or taxes are applied.
-
#amount_total ⇒ Object
readonly
Total after discounts and taxes are applied.
-
#application ⇒ Object
readonly
ID of the Connect Application that created the quote.
-
#application_fee_amount ⇒ Object
readonly
The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account.
-
#application_fee_percent ⇒ Object
readonly
A non-negative decimal between 0 and 100, with at most two decimal places.
-
#automatic_tax ⇒ Object
readonly
Attribute for field automatic_tax.
-
#collection_method ⇒ Object
readonly
Either ‘charge_automatically`, or `send_invoice`.
-
#computed ⇒ Object
readonly
Attribute for field computed.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#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 quote belongs to.
-
#default_tax_rates ⇒ Object
readonly
The tax rates applied to this quote.
-
#description ⇒ Object
readonly
A description that will be displayed on the quote PDF.
-
#discounts ⇒ Object
readonly
The discounts applied to this quote.
-
#expires_at ⇒ Object
readonly
The date on which the quote will be canceled if in ‘open` or `draft` status.
-
#footer ⇒ Object
readonly
A footer that will be displayed on the quote PDF.
-
#from_quote ⇒ Object
readonly
Details of the quote that was cloned.
-
#header ⇒ Object
readonly
A header that will be displayed on the quote PDF.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#invoice ⇒ Object
readonly
The invoice that was created from this quote.
-
#invoice_settings ⇒ Object
readonly
Attribute for field invoice_settings.
-
#line_items ⇒ Object
readonly
A list of items the customer is being quoted for.
-
#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.
-
#number ⇒ Object
readonly
A unique number that identifies this particular quote.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#on_behalf_of ⇒ Object
readonly
The account on behalf of which to charge.
-
#status ⇒ Object
readonly
The status of the quote.
-
#status_transitions ⇒ Object
readonly
Attribute for field status_transitions.
-
#subscription ⇒ Object
readonly
The subscription that was created or updated from this quote.
-
#subscription_data ⇒ Object
readonly
Attribute for field subscription_data.
-
#subscription_schedule ⇒ Object
readonly
The subscription schedule that was created or updated from this quote.
-
#test_clock ⇒ Object
readonly
ID of the test clock this quote belongs to.
-
#total_details ⇒ Object
readonly
Attribute for field total_details.
-
#transfer_data ⇒ Object
readonly
The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.accept(quote, params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
-
.cancel(quote, params = {}, opts = {}) ⇒ Object
Cancels the quote.
-
.create(params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
-
.finalize_quote(quote, params = {}, opts = {}) ⇒ Object
Finalizes the quote.
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your quotes.
-
.list_computed_upfront_line_items(quote, params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable [computed.upfront.line_items](stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items.
-
.list_line_items(quote, params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable line_items property containing the first handful of those items.
- .object_name ⇒ Object
-
.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote.
-
.update(quote, params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
Instance Method Summary collapse
-
#accept(params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
-
#cancel(params = {}, opts = {}) ⇒ Object
Cancels the quote.
-
#finalize_quote(params = {}, opts = {}) ⇒ Object
Finalizes the quote.
-
#list_computed_upfront_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable [computed.upfront.line_items](stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items.
-
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable line_items property containing the first handful of those items.
-
#pdf(params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote.
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_subtotal ⇒ Object (readonly)
Total before any discounts or taxes are applied.
889 890 891 |
# File 'lib/stripe/resources/quote.rb', line 889 def amount_subtotal @amount_subtotal end |
#amount_total ⇒ Object (readonly)
Total after discounts and taxes are applied.
891 892 893 |
# File 'lib/stripe/resources/quote.rb', line 891 def amount_total @amount_total end |
#application ⇒ Object (readonly)
ID of the Connect Application that created the quote.
893 894 895 |
# File 'lib/stripe/resources/quote.rb', line 893 def application @application end |
#application_fee_amount ⇒ Object (readonly)
The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account. Only applicable if there are no line items with recurring prices on the quote.
895 896 897 |
# File 'lib/stripe/resources/quote.rb', line 895 def application_fee_amount @application_fee_amount end |
#application_fee_percent ⇒ Object (readonly)
A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner’s Stripe account. Only applicable if there are line items with recurring prices on the quote.
897 898 899 |
# File 'lib/stripe/resources/quote.rb', line 897 def application_fee_percent @application_fee_percent end |
#automatic_tax ⇒ Object (readonly)
Attribute for field automatic_tax
899 900 901 |
# File 'lib/stripe/resources/quote.rb', line 899 def automatic_tax @automatic_tax end |
#collection_method ⇒ Object (readonly)
Either ‘charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically`.
901 902 903 |
# File 'lib/stripe/resources/quote.rb', line 901 def collection_method @collection_method end |
#computed ⇒ Object (readonly)
Attribute for field computed
903 904 905 |
# File 'lib/stripe/resources/quote.rb', line 903 def computed @computed end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
905 906 907 |
# File 'lib/stripe/resources/quote.rb', line 905 def created @created 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).
907 908 909 |
# File 'lib/stripe/resources/quote.rb', line 907 def currency @currency end |
#customer ⇒ Object (readonly)
The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
909 910 911 |
# File 'lib/stripe/resources/quote.rb', line 909 def customer @customer end |
#default_tax_rates ⇒ Object (readonly)
The tax rates applied to this quote.
911 912 913 |
# File 'lib/stripe/resources/quote.rb', line 911 def default_tax_rates @default_tax_rates end |
#description ⇒ Object (readonly)
A description that will be displayed on the quote PDF.
913 914 915 |
# File 'lib/stripe/resources/quote.rb', line 913 def description @description end |
#discounts ⇒ Object (readonly)
The discounts applied to this quote.
915 916 917 |
# File 'lib/stripe/resources/quote.rb', line 915 def discounts @discounts end |
#expires_at ⇒ Object (readonly)
The date on which the quote will be canceled if in ‘open` or `draft` status. Measured in seconds since the Unix epoch.
917 918 919 |
# File 'lib/stripe/resources/quote.rb', line 917 def expires_at @expires_at end |
#footer ⇒ Object (readonly)
A footer that will be displayed on the quote PDF.
919 920 921 |
# File 'lib/stripe/resources/quote.rb', line 919 def @footer end |
#from_quote ⇒ Object (readonly)
Details of the quote that was cloned. See the [cloning documentation](stripe.com/docs/quotes/clone) for more details.
921 922 923 |
# File 'lib/stripe/resources/quote.rb', line 921 def from_quote @from_quote end |
#header ⇒ Object (readonly)
A header that will be displayed on the quote PDF.
923 924 925 |
# File 'lib/stripe/resources/quote.rb', line 923 def header @header end |
#id ⇒ Object (readonly)
Unique identifier for the object.
925 926 927 |
# File 'lib/stripe/resources/quote.rb', line 925 def id @id end |
#invoice ⇒ Object (readonly)
The invoice that was created from this quote.
927 928 929 |
# File 'lib/stripe/resources/quote.rb', line 927 def invoice @invoice end |
#invoice_settings ⇒ Object (readonly)
Attribute for field invoice_settings
929 930 931 |
# File 'lib/stripe/resources/quote.rb', line 929 def invoice_settings @invoice_settings end |
#line_items ⇒ Object (readonly)
A list of items the customer is being quoted for.
931 932 933 |
# File 'lib/stripe/resources/quote.rb', line 931 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.
933 934 935 |
# File 'lib/stripe/resources/quote.rb', line 933 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.
935 936 937 |
# File 'lib/stripe/resources/quote.rb', line 935 def @metadata end |
#number ⇒ Object (readonly)
A unique number that identifies this particular quote. This number is assigned once the quote is [finalized](stripe.com/docs/quotes/overview#finalize).
937 938 939 |
# File 'lib/stripe/resources/quote.rb', line 937 def number @number end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
939 940 941 |
# File 'lib/stripe/resources/quote.rb', line 939 def object @object end |
#on_behalf_of ⇒ Object (readonly)
The account on behalf of which to charge. See the [Connect documentation](support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details.
941 942 943 |
# File 'lib/stripe/resources/quote.rb', line 941 def on_behalf_of @on_behalf_of end |
#status ⇒ Object (readonly)
The status of the quote.
943 944 945 |
# File 'lib/stripe/resources/quote.rb', line 943 def status @status end |
#status_transitions ⇒ Object (readonly)
Attribute for field status_transitions
945 946 947 |
# File 'lib/stripe/resources/quote.rb', line 945 def status_transitions @status_transitions end |
#subscription ⇒ Object (readonly)
The subscription that was created or updated from this quote.
947 948 949 |
# File 'lib/stripe/resources/quote.rb', line 947 def subscription @subscription end |
#subscription_data ⇒ Object (readonly)
Attribute for field subscription_data
949 950 951 |
# File 'lib/stripe/resources/quote.rb', line 949 def subscription_data @subscription_data end |
#subscription_schedule ⇒ Object (readonly)
The subscription schedule that was created or updated from this quote.
951 952 953 |
# File 'lib/stripe/resources/quote.rb', line 951 def subscription_schedule @subscription_schedule end |
#test_clock ⇒ Object (readonly)
ID of the test clock this quote belongs to.
953 954 955 |
# File 'lib/stripe/resources/quote.rb', line 953 def test_clock @test_clock end |
#total_details ⇒ Object (readonly)
Attribute for field total_details
955 956 957 |
# File 'lib/stripe/resources/quote.rb', line 955 def total_details @total_details end |
#transfer_data ⇒ Object (readonly)
The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices.
957 958 959 |
# File 'lib/stripe/resources/quote.rb', line 957 def transfer_data @transfer_data end |
Class Method Details
.accept(quote, params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
970 971 972 973 974 975 976 977 |
# File 'lib/stripe/resources/quote.rb', line 970 def self.accept(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.cancel(quote, params = {}, opts = {}) ⇒ Object
Cancels the quote.
990 991 992 993 994 995 996 997 |
# File 'lib/stripe/resources/quote.rb', line 990 def self.cancel(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](dashboard.stripe.com/settings/billing/quote).
1000 1001 1002 |
# File 'lib/stripe/resources/quote.rb', line 1000 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts) end |
.finalize_quote(quote, params = {}, opts = {}) ⇒ Object
Finalizes the quote.
1015 1016 1017 1018 1019 1020 1021 1022 |
# File 'lib/stripe/resources/quote.rb', line 1015 def self.finalize_quote(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your quotes.
1025 1026 1027 |
# File 'lib/stripe/resources/quote.rb', line 1025 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/quotes", params: params, opts: opts) end |
.list_computed_upfront_line_items(quote, params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable [computed.upfront.line_items](stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
1040 1041 1042 1043 1044 1045 1046 1047 |
# File 'lib/stripe/resources/quote.rb', line 1040 def self.list_computed_upfront_line_items(quote, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.list_line_items(quote, params = {}, opts = {}) ⇒ Object
When retrieving a quote, 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.
1060 1061 1062 1063 1064 1065 1066 1067 |
# File 'lib/stripe/resources/quote.rb', line 1060 def self.list_line_items(quote, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.object_name ⇒ Object
13 14 15 |
# File 'lib/stripe/resources/quote.rb', line 13 def self.object_name "quote" end |
.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote. Explanation for special handling can be found [here](docs.stripe.com/quotes/overview#quote_pdf)
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 |
# File 'lib/stripe/resources/quote.rb', line 1083 def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts) execute_resource_request_stream( :get, format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(quote) }), :files, params, opts, &read_body_chunk_block ) end |
.update(quote, params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
1096 1097 1098 1099 1100 1101 1102 1103 |
# File 'lib/stripe/resources/quote.rb', line 1096 def self.update(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
Instance Method Details
#accept(params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
960 961 962 963 964 965 966 967 |
# File 'lib/stripe/resources/quote.rb', line 960 def accept(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#cancel(params = {}, opts = {}) ⇒ Object
Cancels the quote.
980 981 982 983 984 985 986 987 |
# File 'lib/stripe/resources/quote.rb', line 980 def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#finalize_quote(params = {}, opts = {}) ⇒ Object
Finalizes the quote.
1005 1006 1007 1008 1009 1010 1011 1012 |
# File 'lib/stripe/resources/quote.rb', line 1005 def finalize_quote(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#list_computed_upfront_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable [computed.upfront.line_items](stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
1030 1031 1032 1033 1034 1035 1036 1037 |
# File 'lib/stripe/resources/quote.rb', line 1030 def list_computed_upfront_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a quote, 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.
1050 1051 1052 1053 1054 1055 1056 1057 |
# File 'lib/stripe/resources/quote.rb', line 1050 def list_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#pdf(params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote. Explanation for special handling can be found [here](docs.stripe.com/quotes/overview#quote_pdf)
1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 |
# File 'lib/stripe/resources/quote.rb', line 1070 def pdf(params = {}, opts = {}, &read_body_chunk_block) opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts) request_stream( method: :get, path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }), params: params, opts: opts, base_address: :files, &read_body_chunk_block ) end |