Class: Stripe::Tax::Calculation
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Tax::Calculation
- Extended by:
- APIOperations::Create
- Defined in:
- lib/stripe/resources/tax/calculation.rb
Overview
A Tax Calculation allows you to calculate the tax to collect from your customer.
Related guide: [Calculate tax in your custom payment flow](stripe.com/docs/tax/custom)
Defined Under Namespace
Classes: CreateParams, CustomerDetails, ListLineItemsParams, RetrieveParams, ShipFromDetails, ShippingCost, TaxBreakdown
Constant Summary collapse
- OBJECT_NAME =
"tax.calculation"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount_total ⇒ Object
readonly
Total amount after taxes in the [smallest currency unit](stripe.com/docs/currencies#zero-decimal).
-
#currency ⇒ Object
readonly
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#customer ⇒ Object
readonly
The ID of an existing [Customer](stripe.com/docs/api/customers/object) used for the resource.
-
#customer_details ⇒ Object
readonly
Attribute for field customer_details.
-
#expires_at ⇒ Object
readonly
Timestamp of date at which the tax calculation will expire.
-
#id ⇒ Object
readonly
Unique identifier for the calculation.
-
#line_items ⇒ Object
readonly
The list of items the customer is purchasing.
-
#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.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#ship_from_details ⇒ Object
readonly
The details of the ship from location, such as the address.
-
#shipping_cost ⇒ Object
readonly
The shipping cost details for the calculation.
-
#tax_amount_exclusive ⇒ Object
readonly
The amount of tax to be collected on top of the line item prices.
-
#tax_amount_inclusive ⇒ Object
readonly
The amount of tax already included in the line item prices.
-
#tax_breakdown ⇒ Object
readonly
Breakdown of individual tax amounts that add up to the total.
-
#tax_date ⇒ Object
readonly
Timestamp of date at which the tax rules and rates in effect applies for the calculation.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
Calculates tax based on the input and returns a Tax Calculation object.
-
.list_line_items(calculation, params = {}, opts = {}) ⇒ Object
Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
- .object_name ⇒ Object
Instance Method Summary collapse
-
#list_line_items(params = {}, opts = {}) ⇒ Object
Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
Methods included from APIOperations::Create
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_total ⇒ Object (readonly)
Total amount after taxes in the [smallest currency unit](stripe.com/docs/currencies#zero-decimal).
447 448 449 |
# File 'lib/stripe/resources/tax/calculation.rb', line 447 def amount_total @amount_total 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).
450 451 452 |
# File 'lib/stripe/resources/tax/calculation.rb', line 450 def currency @currency end |
#customer ⇒ Object (readonly)
The ID of an existing [Customer](stripe.com/docs/api/customers/object) used for the resource.
453 454 455 |
# File 'lib/stripe/resources/tax/calculation.rb', line 453 def customer @customer end |
#customer_details ⇒ Object (readonly)
Attribute for field customer_details
456 457 458 |
# File 'lib/stripe/resources/tax/calculation.rb', line 456 def customer_details @customer_details end |
#expires_at ⇒ Object (readonly)
Timestamp of date at which the tax calculation will expire.
459 460 461 |
# File 'lib/stripe/resources/tax/calculation.rb', line 459 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Unique identifier for the calculation.
462 463 464 |
# File 'lib/stripe/resources/tax/calculation.rb', line 462 def id @id end |
#line_items ⇒ Object (readonly)
The list of items the customer is purchasing.
465 466 467 |
# File 'lib/stripe/resources/tax/calculation.rb', line 465 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.
468 469 470 |
# File 'lib/stripe/resources/tax/calculation.rb', line 468 def livemode @livemode end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
471 472 473 |
# File 'lib/stripe/resources/tax/calculation.rb', line 471 def object @object end |
#ship_from_details ⇒ Object (readonly)
The details of the ship from location, such as the address.
474 475 476 |
# File 'lib/stripe/resources/tax/calculation.rb', line 474 def ship_from_details @ship_from_details end |
#shipping_cost ⇒ Object (readonly)
The shipping cost details for the calculation.
477 478 479 |
# File 'lib/stripe/resources/tax/calculation.rb', line 477 def shipping_cost @shipping_cost end |
#tax_amount_exclusive ⇒ Object (readonly)
The amount of tax to be collected on top of the line item prices.
480 481 482 |
# File 'lib/stripe/resources/tax/calculation.rb', line 480 def tax_amount_exclusive @tax_amount_exclusive end |
#tax_amount_inclusive ⇒ Object (readonly)
The amount of tax already included in the line item prices.
483 484 485 |
# File 'lib/stripe/resources/tax/calculation.rb', line 483 def tax_amount_inclusive @tax_amount_inclusive end |
#tax_breakdown ⇒ Object (readonly)
Breakdown of individual tax amounts that add up to the total.
486 487 488 |
# File 'lib/stripe/resources/tax/calculation.rb', line 486 def tax_breakdown @tax_breakdown end |
#tax_date ⇒ Object (readonly)
Timestamp of date at which the tax rules and rates in effect applies for the calculation.
489 490 491 |
# File 'lib/stripe/resources/tax/calculation.rb', line 489 def tax_date @tax_date end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Calculates tax based on the input and returns a Tax Calculation object.
492 493 494 495 496 497 498 499 |
# File 'lib/stripe/resources/tax/calculation.rb', line 492 def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/tax/calculations", params: params, opts: opts ) end |
.list_line_items(calculation, params = {}, opts = {}) ⇒ Object
Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
512 513 514 515 516 517 518 519 |
# File 'lib/stripe/resources/tax/calculation.rb', line 512 def self.list_line_items(calculation, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/tax/calculations/%<calculation>s/line_items", { calculation: CGI.escape(calculation) }), params: params, opts: opts ) end |
.object_name ⇒ Object
13 14 15 |
# File 'lib/stripe/resources/tax/calculation.rb', line 13 def self.object_name "tax.calculation" end |
Instance Method Details
#list_line_items(params = {}, opts = {}) ⇒ Object
Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
502 503 504 505 506 507 508 509 |
# File 'lib/stripe/resources/tax/calculation.rb', line 502 def list_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/tax/calculations/%<calculation>s/line_items", { calculation: CGI.escape(self["id"]) }), params: params, opts: opts ) end |