Class: Stripe::TaxRate
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::TaxRate
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/tax_rate.rb
Overview
Tax rates can be applied to [invoices](docs.stripe.com/invoicing/taxes/tax-rates), [subscriptions](docs.stripe.com/billing/taxes/tax-rates) and [Checkout Sessions](docs.stripe.com/payments/checkout/use-manual-tax-rates) to collect tax.
Related guide: [Tax rates](docs.stripe.com/billing/taxes/tax-rates)
Defined Under Namespace
Classes: FlatAmount
Constant Summary collapse
- OBJECT_NAME =
"tax_rate"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Defaults to ‘true`.
-
#country ⇒ Object
readonly
Two-letter country code ([ISO 3166-1 alpha-2](en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#description ⇒ Object
readonly
An arbitrary string attached to the tax rate for your internal use only.
-
#display_name ⇒ Object
readonly
The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.
-
#effective_percentage ⇒ Object
readonly
Actual/effective tax rate percentage out of 100.
-
#flat_amount ⇒ Object
readonly
The amount of the tax rate when the ‘rate_type` is `flat_amount`.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#inclusive ⇒ Object
readonly
This specifies if the tax rate is inclusive or exclusive.
-
#jurisdiction ⇒ Object
readonly
The jurisdiction for the tax rate.
-
#jurisdiction_level ⇒ Object
readonly
The level of the jurisdiction that imposes this tax rate.
-
#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.
-
#percentage ⇒ Object
readonly
Tax rate percentage out of 100.
-
#rate_type ⇒ Object
readonly
Indicates the type of tax rate applied to the taxable amount.
-
#state ⇒ Object
readonly
[ISO 3166-2 subdivision code](en.wikipedia.org/wiki/ISO_3166-2), without country prefix.
-
#tax_type ⇒ Object
readonly
The high-level tax type, such as ‘vat` or `sales_tax`.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
Creates a new tax rate.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your tax rates.
- .object_name ⇒ Object
-
.update(tax_rate, params = {}, opts = {}) ⇒ Object
Updates an existing tax rate.
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?, #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
#active ⇒ Object (readonly)
Defaults to ‘true`. When set to `false`, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.
33 34 35 |
# File 'lib/stripe/resources/tax_rate.rb', line 33 def active @active end |
#country ⇒ Object (readonly)
Two-letter country code ([ISO 3166-1 alpha-2](en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
35 36 37 |
# File 'lib/stripe/resources/tax_rate.rb', line 35 def country @country end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
37 38 39 |
# File 'lib/stripe/resources/tax_rate.rb', line 37 def created @created end |
#description ⇒ Object (readonly)
An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.
39 40 41 |
# File 'lib/stripe/resources/tax_rate.rb', line 39 def description @description end |
#display_name ⇒ Object (readonly)
The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.
41 42 43 |
# File 'lib/stripe/resources/tax_rate.rb', line 41 def display_name @display_name end |
#effective_percentage ⇒ Object (readonly)
Actual/effective tax rate percentage out of 100. For tax calculations with automatic_tax=true, this percentage reflects the rate actually used to calculate tax based on the product’s taxability and whether the user is registered to collect taxes in the corresponding jurisdiction.
45 46 47 |
# File 'lib/stripe/resources/tax_rate.rb', line 45 def effective_percentage @effective_percentage end |
#flat_amount ⇒ Object (readonly)
The amount of the tax rate when the ‘rate_type` is `flat_amount`. Tax rates with `rate_type` `percentage` can vary based on the transaction, resulting in this field being `null`. This field exposes the amount and currency of the flat tax rate.
47 48 49 |
# File 'lib/stripe/resources/tax_rate.rb', line 47 def flat_amount @flat_amount end |
#id ⇒ Object (readonly)
Unique identifier for the object.
49 50 51 |
# File 'lib/stripe/resources/tax_rate.rb', line 49 def id @id end |
#inclusive ⇒ Object (readonly)
This specifies if the tax rate is inclusive or exclusive.
51 52 53 |
# File 'lib/stripe/resources/tax_rate.rb', line 51 def inclusive @inclusive end |
#jurisdiction ⇒ Object (readonly)
The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.
53 54 55 |
# File 'lib/stripe/resources/tax_rate.rb', line 53 def jurisdiction @jurisdiction end |
#jurisdiction_level ⇒ Object (readonly)
The level of the jurisdiction that imposes this tax rate. Will be ‘null` for manually defined tax rates.
55 56 57 |
# File 'lib/stripe/resources/tax_rate.rb', line 55 def jurisdiction_level @jurisdiction_level 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.
57 58 59 |
# File 'lib/stripe/resources/tax_rate.rb', line 57 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.
59 60 61 |
# File 'lib/stripe/resources/tax_rate.rb', line 59 def end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
61 62 63 |
# File 'lib/stripe/resources/tax_rate.rb', line 61 def object @object end |
#percentage ⇒ Object (readonly)
Tax rate percentage out of 100. For tax calculations with automatic_tax=true, this percentage includes the statutory tax rate of non-taxable jurisdictions.
63 64 65 |
# File 'lib/stripe/resources/tax_rate.rb', line 63 def percentage @percentage end |
#rate_type ⇒ Object (readonly)
Indicates the type of tax rate applied to the taxable amount. This value can be ‘null` when no tax applies to the location. This field is only present for TaxRates created by Stripe Tax.
65 66 67 |
# File 'lib/stripe/resources/tax_rate.rb', line 65 def rate_type @rate_type end |
#state ⇒ Object (readonly)
[ISO 3166-2 subdivision code](en.wikipedia.org/wiki/ISO_3166-2), without country prefix. For example, “NY” for New York, United States.
67 68 69 |
# File 'lib/stripe/resources/tax_rate.rb', line 67 def state @state end |
#tax_type ⇒ Object (readonly)
The high-level tax type, such as ‘vat` or `sales_tax`.
69 70 71 |
# File 'lib/stripe/resources/tax_rate.rb', line 69 def tax_type @tax_type end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Creates a new tax rate.
72 73 74 |
# File 'lib/stripe/resources/tax_rate.rb', line 72 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/tax_rates", params: params, opts: opts) end |
.field_remappings ⇒ Object
95 96 97 |
# File 'lib/stripe/resources/tax_rate.rb', line 95 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
91 92 93 |
# File 'lib/stripe/resources/tax_rate.rb', line 91 def self.inner_class_types @inner_class_types = { flat_amount: FlatAmount } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your tax rates. Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first.
77 78 79 |
# File 'lib/stripe/resources/tax_rate.rb', line 77 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/tax_rates", params: params, opts: opts) end |
.object_name ⇒ Object
14 15 16 |
# File 'lib/stripe/resources/tax_rate.rb', line 14 def self.object_name "tax_rate" end |
.update(tax_rate, params = {}, opts = {}) ⇒ Object
Updates an existing tax rate.
82 83 84 85 86 87 88 89 |
# File 'lib/stripe/resources/tax_rate.rb', line 82 def self.update(tax_rate, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/tax_rates/%<tax_rate>s", { tax_rate: CGI.escape(tax_rate) }), params: params, opts: opts ) end |