Class: Stripe::Tax::Transaction

Inherits:
APIResource show all
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](stripe.com/docs/tax/custom#tax-transaction)

Constant Summary collapse

OBJECT_NAME =
"tax.transaction"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

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

included

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

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.



16
17
18
19
20
21
22
23
# File 'lib/stripe/resources/tax/transaction.rb', line 16

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.



26
27
28
29
30
31
32
33
# File 'lib/stripe/resources/tax/transaction.rb', line 26

def self.create_reversal(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "/v1/tax/transactions/create_reversal",
    params: params,
    opts: opts
  )
end

.list_line_items(transaction, params = {}, opts = {}) ⇒ Object

Retrieves the line items of a committed standalone transaction as a collection.



46
47
48
49
50
51
52
53
# File 'lib/stripe/resources/tax/transaction.rb', line 46

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_nameObject



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.



36
37
38
39
40
41
42
43
# File 'lib/stripe/resources/tax/transaction.rb', line 36

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