Class: Stripe::Tax::Transaction
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Tax::Transaction
- Defined in:
- lib/stripe/resources/tax/transaction.rb
Overview
A Tax Transaction records the tax collected from or refunded to your customer.
Related guide: [Calculate tax in your custom payment flow](docs.stripe.com/tax/custom#tax-transaction)
Defined Under Namespace
Classes: CustomerDetails, Reversal, ShipFromDetails, ShippingCost
Constant Summary collapse
- OBJECT_NAME =
"tax.transaction"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#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 ID of an existing [Customer](docs.stripe.com/api/customers/object) used for the resource.
-
#customer_details ⇒ Object
readonly
Attribute for field customer_details.
-
#id ⇒ Object
readonly
Unique identifier for the transaction.
-
#line_items ⇒ Object
readonly
The tax collected or refunded, by line item.
-
#livemode ⇒ Object
readonly
If the object exists in live mode, the value is ‘true`.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#posted_at ⇒ Object
readonly
The Unix timestamp representing when the tax liability is assumed or reduced.
-
#reference ⇒ Object
readonly
A custom unique identifier, such as ‘myOrder_123’.
-
#reversal ⇒ Object
readonly
If ‘type=reversal`, contains information about what was reversed.
-
#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 transaction.
-
#tax_date ⇒ Object
readonly
The calculation uses the tax rules and rates that are in effect at this timestamp.
-
#type ⇒ Object
readonly
If ‘reversal`, this transaction reverses an earlier transaction.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create_from_calculation(params = {}, opts = {}) ⇒ Object
Creates a Tax Transaction from a calculation, if that calculation hasn’t expired.
-
.create_reversal(params = {}, opts = {}) ⇒ Object
Partially or fully reverses a previously created Transaction.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list_line_items(transaction, params = {}, opts = {}) ⇒ Object
Retrieves the line items of a committed standalone transaction as a collection.
- .object_name ⇒ Object
Instance Method Summary collapse
-
#list_line_items(params = {}, opts = {}) ⇒ Object
Retrieves the line items of a committed standalone transaction as a collection.
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
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
201 202 203 |
# File 'lib/stripe/resources/tax/transaction.rb', line 201 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).
203 204 205 |
# File 'lib/stripe/resources/tax/transaction.rb', line 203 def currency @currency end |
#customer ⇒ Object (readonly)
The ID of an existing [Customer](docs.stripe.com/api/customers/object) used for the resource.
205 206 207 |
# File 'lib/stripe/resources/tax/transaction.rb', line 205 def customer @customer end |
#customer_details ⇒ Object (readonly)
Attribute for field customer_details
207 208 209 |
# File 'lib/stripe/resources/tax/transaction.rb', line 207 def customer_details @customer_details end |
#id ⇒ Object (readonly)
Unique identifier for the transaction.
209 210 211 |
# File 'lib/stripe/resources/tax/transaction.rb', line 209 def id @id end |
#line_items ⇒ Object (readonly)
The tax collected or refunded, by line item.
211 212 213 |
# File 'lib/stripe/resources/tax/transaction.rb', line 211 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`.
213 214 215 |
# File 'lib/stripe/resources/tax/transaction.rb', line 213 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
215 216 217 |
# File 'lib/stripe/resources/tax/transaction.rb', line 215 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
217 218 219 |
# File 'lib/stripe/resources/tax/transaction.rb', line 217 def object @object end |
#posted_at ⇒ Object (readonly)
The Unix timestamp representing when the tax liability is assumed or reduced.
219 220 221 |
# File 'lib/stripe/resources/tax/transaction.rb', line 219 def posted_at @posted_at end |
#reference ⇒ Object (readonly)
A custom unique identifier, such as ‘myOrder_123’.
221 222 223 |
# File 'lib/stripe/resources/tax/transaction.rb', line 221 def reference @reference end |
#reversal ⇒ Object (readonly)
If ‘type=reversal`, contains information about what was reversed.
223 224 225 |
# File 'lib/stripe/resources/tax/transaction.rb', line 223 def reversal @reversal end |
#ship_from_details ⇒ Object (readonly)
The details of the ship from location, such as the address.
225 226 227 |
# File 'lib/stripe/resources/tax/transaction.rb', line 225 def ship_from_details @ship_from_details end |
#shipping_cost ⇒ Object (readonly)
The shipping cost details for the transaction.
227 228 229 |
# File 'lib/stripe/resources/tax/transaction.rb', line 227 def shipping_cost @shipping_cost end |
#tax_date ⇒ Object (readonly)
The calculation uses the tax rules and rates that are in effect at this timestamp. You can use a date up to 31 days in the past or up to 31 days in the future. If you use a future date, Stripe doesn’t guarantee that the expected tax rules and rate being used match the actual rules and rate that will be in effect on that date. We deploy tax changes before their effective date, but not within a fixed window.
229 230 231 |
# File 'lib/stripe/resources/tax/transaction.rb', line 229 def tax_date @tax_date end |
#type ⇒ Object (readonly)
If ‘reversal`, this transaction reverses an earlier transaction.
231 232 233 |
# File 'lib/stripe/resources/tax/transaction.rb', line 231 def type @type end |
Class Method Details
.create_from_calculation(params = {}, opts = {}) ⇒ Object
Creates a Tax Transaction from a calculation, if that calculation hasn’t expired. Calculations expire after 90 days.
234 235 236 237 238 239 240 241 |
# File 'lib/stripe/resources/tax/transaction.rb', line 234 def self.create_from_calculation(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/tax/transactions/create_from_calculation", params: params, opts: opts ) end |
.create_reversal(params = {}, opts = {}) ⇒ Object
Partially or fully reverses a previously created Transaction.
244 245 246 247 248 249 250 251 |
# File 'lib/stripe/resources/tax/transaction.rb', line 244 def self.create_reversal(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/tax/transactions/create_reversal", params: params, opts: opts ) end |
.field_remappings ⇒ Object
282 283 284 |
# File 'lib/stripe/resources/tax/transaction.rb', line 282 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
273 274 275 276 277 278 279 280 |
# File 'lib/stripe/resources/tax/transaction.rb', line 273 def self.inner_class_types @inner_class_types = { customer_details: CustomerDetails, reversal: Reversal, ship_from_details: ShipFromDetails, shipping_cost: ShippingCost, } end |
.list_line_items(transaction, params = {}, opts = {}) ⇒ Object
Retrieves the line items of a committed standalone transaction as a collection.
264 265 266 267 268 269 270 271 |
# File 'lib/stripe/resources/tax/transaction.rb', line 264 def self.list_line_items(transaction, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/tax/transactions/%<transaction>s/line_items", { transaction: CGI.escape(transaction) }), params: params, opts: opts ) end |
.object_name ⇒ Object
11 12 13 |
# File 'lib/stripe/resources/tax/transaction.rb', line 11 def self.object_name "tax.transaction" end |
Instance Method Details
#list_line_items(params = {}, opts = {}) ⇒ Object
Retrieves the line items of a committed standalone transaction as a collection.
254 255 256 257 258 259 260 261 |
# File 'lib/stripe/resources/tax/transaction.rb', line 254 def list_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/tax/transactions/%<transaction>s/line_items", { transaction: CGI.escape(self["id"]) }), params: params, opts: opts ) end |