Sha256: e781c07490193adf318e979f50e215bc6220170645ecbef6815aa3bf4b141cf2

Contents?: true

Size: 1.8 KB

Versions: 5

Compression:

Stored size: 1.8 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  module Tax
    # A Tax Transaction records the tax collected from or refunded to your customer.
    #
    # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom#tax-transaction)
    class Transaction < APIResource
      OBJECT_NAME = "tax.transaction"
      def self.object_name
        "tax.transaction"
      end

      # Retrieves the line items of a committed standalone transaction as a collection.
      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

      # Creates a Tax Transaction from a calculation.
      def self.create_from_calculation(params = {}, opts = {})
        request_stripe_object(
          method: :post,
          path: "/v1/tax/transactions/create_from_calculation",
          params: params,
          opts: opts
        )
      end

      # Partially or fully reverses a previously created Transaction.
      def self.create_reversal(params = {}, opts = {})
        request_stripe_object(
          method: :post,
          path: "/v1/tax/transactions/create_reversal",
          params: params,
          opts: opts
        )
      end

      # Retrieves the line items of a committed standalone transaction as a collection.
      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stripe-10.11.0 lib/stripe/resources/tax/transaction.rb
stripe-10.11.0.pre.beta.1 lib/stripe/resources/tax/transaction.rb
stripe-10.10.0 lib/stripe/resources/tax/transaction.rb
stripe-10.10.0.pre.beta.1 lib/stripe/resources/tax/transaction.rb
stripe-10.9.0 lib/stripe/resources/tax/transaction.rb