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: AutomaticTax, Computed, FromQuote, InvoiceSettings, StatusTransitions, SubscriptionData, TotalDetails, TransferData
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, orsend_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, in lowercase.
-
#customer ⇒ Object
readonly
The customer who received this quote.
-
#customer_account ⇒ Object
readonly
The account representing the customer who received this quote.
-
#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
openordraftstatus. -
#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
If the object exists in live mode, the value is
true. -
#metadata ⇒ Object
readonly
Set of key-value pairs 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.
- .field_remappings ⇒ Object
-
.finalize_quote(quote, params = {}, opts = {}) ⇒ Object
Finalizes the quote.
- .inner_class_types ⇒ Object
-
.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 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 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
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #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.
461 462 463 |
# File 'lib/stripe/resources/quote.rb', line 461 def amount_subtotal @amount_subtotal end |
#amount_total ⇒ Object (readonly)
Total after discounts and taxes are applied.
463 464 465 |
# File 'lib/stripe/resources/quote.rb', line 463 def amount_total @amount_total end |
#application ⇒ Object (readonly)
ID of the Connect Application that created the quote.
465 466 467 |
# File 'lib/stripe/resources/quote.rb', line 465 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.
467 468 469 |
# File 'lib/stripe/resources/quote.rb', line 467 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.
469 470 471 |
# File 'lib/stripe/resources/quote.rb', line 469 def application_fee_percent @application_fee_percent end |
#automatic_tax ⇒ Object (readonly)
Attribute for field automatic_tax
471 472 473 |
# File 'lib/stripe/resources/quote.rb', line 471 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.
473 474 475 |
# File 'lib/stripe/resources/quote.rb', line 473 def collection_method @collection_method end |
#computed ⇒ Object (readonly)
Attribute for field computed
475 476 477 |
# File 'lib/stripe/resources/quote.rb', line 475 def computed @computed end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
477 478 479 |
# File 'lib/stripe/resources/quote.rb', line 477 def created @created end |
#currency ⇒ Object (readonly)
Three-letter ISO currency code, in lowercase. Must be a supported currency.
479 480 481 |
# File 'lib/stripe/resources/quote.rb', line 479 def currency @currency end |
#customer ⇒ Object (readonly)
The customer who received this quote. A customer is required to finalize the quote. Once specified, you can't change it.
481 482 483 |
# File 'lib/stripe/resources/quote.rb', line 481 def customer @customer end |
#customer_account ⇒ Object (readonly)
The account representing the customer who received this quote. A customer or account is required to finalize the quote. Once specified, you can't change it.
483 484 485 |
# File 'lib/stripe/resources/quote.rb', line 483 def customer_account @customer_account end |
#default_tax_rates ⇒ Object (readonly)
The tax rates applied to this quote.
485 486 487 |
# File 'lib/stripe/resources/quote.rb', line 485 def default_tax_rates @default_tax_rates end |
#description ⇒ Object (readonly)
A description that will be displayed on the quote PDF.
487 488 489 |
# File 'lib/stripe/resources/quote.rb', line 487 def description @description end |
#discounts ⇒ Object (readonly)
The discounts applied to this quote.
489 490 491 |
# File 'lib/stripe/resources/quote.rb', line 489 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.
491 492 493 |
# File 'lib/stripe/resources/quote.rb', line 491 def expires_at @expires_at end |
#footer ⇒ Object (readonly)
A footer that will be displayed on the quote PDF.
493 494 495 |
# File 'lib/stripe/resources/quote.rb', line 493 def @footer end |
#from_quote ⇒ Object (readonly)
Details of the quote that was cloned. See the cloning documentation for more details.
495 496 497 |
# File 'lib/stripe/resources/quote.rb', line 495 def from_quote @from_quote end |
#header ⇒ Object (readonly)
A header that will be displayed on the quote PDF.
497 498 499 |
# File 'lib/stripe/resources/quote.rb', line 497 def header @header end |
#id ⇒ Object (readonly)
Unique identifier for the object.
499 500 501 |
# File 'lib/stripe/resources/quote.rb', line 499 def id @id end |
#invoice ⇒ Object (readonly)
The invoice that was created from this quote.
501 502 503 |
# File 'lib/stripe/resources/quote.rb', line 501 def invoice @invoice end |
#invoice_settings ⇒ Object (readonly)
Attribute for field invoice_settings
503 504 505 |
# File 'lib/stripe/resources/quote.rb', line 503 def invoice_settings @invoice_settings end |
#line_items ⇒ Object (readonly)
A list of items the customer is being quoted for.
505 506 507 |
# File 'lib/stripe/resources/quote.rb', line 505 def line_items @line_items end |
#livemode ⇒ Object (readonly)
If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
507 508 509 |
# File 'lib/stripe/resources/quote.rb', line 507 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
509 510 511 |
# File 'lib/stripe/resources/quote.rb', line 509 def @metadata end |
#number ⇒ Object (readonly)
A unique number that identifies this particular quote. This number is assigned once the quote is finalized.
511 512 513 |
# File 'lib/stripe/resources/quote.rb', line 511 def number @number end |
#object ⇒ Object (readonly)
String representing the object's type. Objects of the same type share the same value.
513 514 515 |
# File 'lib/stripe/resources/quote.rb', line 513 def object @object end |
#on_behalf_of ⇒ Object (readonly)
The account on behalf of which to charge. See the Connect documentation for details.
515 516 517 |
# File 'lib/stripe/resources/quote.rb', line 515 def on_behalf_of @on_behalf_of end |
#status ⇒ Object (readonly)
The status of the quote.
517 518 519 |
# File 'lib/stripe/resources/quote.rb', line 517 def status @status end |
#status_transitions ⇒ Object (readonly)
Attribute for field status_transitions
519 520 521 |
# File 'lib/stripe/resources/quote.rb', line 519 def status_transitions @status_transitions end |
#subscription ⇒ Object (readonly)
The subscription that was created or updated from this quote.
521 522 523 |
# File 'lib/stripe/resources/quote.rb', line 521 def subscription @subscription end |
#subscription_data ⇒ Object (readonly)
Attribute for field subscription_data
523 524 525 |
# File 'lib/stripe/resources/quote.rb', line 523 def subscription_data @subscription_data end |
#subscription_schedule ⇒ Object (readonly)
The subscription schedule that was created or updated from this quote.
525 526 527 |
# File 'lib/stripe/resources/quote.rb', line 525 def subscription_schedule @subscription_schedule end |
#test_clock ⇒ Object (readonly)
ID of the test clock this quote belongs to.
527 528 529 |
# File 'lib/stripe/resources/quote.rb', line 527 def test_clock @test_clock end |
#total_details ⇒ Object (readonly)
Attribute for field total_details
529 530 531 |
# File 'lib/stripe/resources/quote.rb', line 529 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.
531 532 533 |
# File 'lib/stripe/resources/quote.rb', line 531 def transfer_data @transfer_data end |
Class Method Details
.accept(quote, params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
544 545 546 547 548 549 550 551 |
# File 'lib/stripe/resources/quote.rb', line 544 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.
564 565 566 567 568 569 570 571 |
# File 'lib/stripe/resources/quote.rb', line 564 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.
574 575 576 |
# File 'lib/stripe/resources/quote.rb', line 574 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts) end |
.field_remappings ⇒ Object
692 693 694 |
# File 'lib/stripe/resources/quote.rb', line 692 def self.field_remappings @field_remappings = {} end |
.finalize_quote(quote, params = {}, opts = {}) ⇒ Object
Finalizes the quote.
589 590 591 592 593 594 595 596 |
# File 'lib/stripe/resources/quote.rb', line 589 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 |
.inner_class_types ⇒ Object
679 680 681 682 683 684 685 686 687 688 689 690 |
# File 'lib/stripe/resources/quote.rb', line 679 def self.inner_class_types @inner_class_types = { automatic_tax: AutomaticTax, computed: Computed, from_quote: FromQuote, invoice_settings: InvoiceSettings, status_transitions: StatusTransitions, subscription_data: SubscriptionData, total_details: TotalDetails, transfer_data: TransferData, } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your quotes.
599 600 601 |
# File 'lib/stripe/resources/quote.rb', line 599 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 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.
614 615 616 617 618 619 620 621 |
# File 'lib/stripe/resources/quote.rb', line 614 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.
634 635 636 637 638 639 640 641 |
# File 'lib/stripe/resources/quote.rb', line 634 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
657 658 659 660 661 662 663 664 665 666 667 |
# File 'lib/stripe/resources/quote.rb', line 657 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.
670 671 672 673 674 675 676 677 |
# File 'lib/stripe/resources/quote.rb', line 670 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.
534 535 536 537 538 539 540 541 |
# File 'lib/stripe/resources/quote.rb', line 534 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.
554 555 556 557 558 559 560 561 |
# File 'lib/stripe/resources/quote.rb', line 554 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.
579 580 581 582 583 584 585 586 |
# File 'lib/stripe/resources/quote.rb', line 579 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 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.
604 605 606 607 608 609 610 611 |
# File 'lib/stripe/resources/quote.rb', line 604 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.
624 625 626 627 628 629 630 631 |
# File 'lib/stripe/resources/quote.rb', line 624 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
644 645 646 647 648 649 650 651 652 653 654 |
# File 'lib/stripe/resources/quote.rb', line 644 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 |