View Source Stripe.Tax.Transaction (stripity_stripe v3.2.0)

A Tax Transaction records the tax collected from or refunded to your customer.

Related guide: Calculate tax in your custom payment flow

Summary

Types

The shipping cost to reverse.

t()

The tax.transaction type.

Functions

Creates a Tax Transaction from a calculation.

Partially or fully reverses a previously created Transaction.

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

Retrieves a Tax Transaction object.

Types

@type line_items() :: %{
  optional(:amount) => integer(),
  optional(:amount_tax) => integer(),
  optional(:metadata) => %{optional(binary()) => binary()},
  optional(:original_line_item) => binary(),
  optional(:quantity) => integer(),
  optional(:reference) => binary()
}
@type shipping_cost() :: %{
  optional(:amount) => integer(),
  optional(:amount_tax) => integer()
}

The shipping cost to reverse.

@type t() :: %Stripe.Tax.Transaction{
  created: integer(),
  currency: binary(),
  customer: binary() | nil,
  customer_details: term(),
  id: binary(),
  line_items: term() | nil,
  livemode: boolean(),
  metadata: term() | nil,
  object: binary(),
  reference: binary(),
  reversal: term() | nil,
  shipping_cost: term() | nil,
  tax_date: integer(),
  type: binary()
}

The tax.transaction type.

  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
  • customer The ID of an existing Customer used for the resource.
  • customer_details
  • id Unique identifier for the transaction.
  • line_items The tax collected or refunded, by line item.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
  • object String representing the object's type. Objects of the same type share the same value.
  • reference A custom unique identifier, such as 'myOrder_123'.
  • reversal If type=reversal, contains information about what was reversed.
  • shipping_cost The shipping cost details for the transaction.
  • tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation.
  • type If reversal, this transaction reverses an earlier transaction.

Functions

Link to this function

create_from_calculation(params \\ %{}, opts \\ [])

View Source
@spec create_from_calculation(
  params :: %{
    optional(:calculation) => binary(),
    optional(:expand) => [binary()],
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:reference) => binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Creates a Tax Transaction from a calculation.

Details

  • Method: post
  • Path: /v1/tax/transactions/create_from_calculation
Link to this function

create_reversal(params \\ %{}, opts \\ [])

View Source
@spec create_reversal(
  params :: %{
    optional(:expand) => [binary()],
    optional(:flat_amount) => integer(),
    optional(:line_items) => [line_items()],
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:mode) => :full | :partial,
    optional(:original_transaction) => binary(),
    optional(:reference) => binary(),
    optional(:shipping_cost) => shipping_cost()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Partially or fully reverses a previously created Transaction.

Details

  • Method: post
  • Path: /v1/tax/transactions/create_reversal
Link to this function

list_line_items(transaction, params \\ %{}, opts \\ [])

View Source
@spec list_line_items(
  transaction :: binary(),
  params :: %{
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(Stripe.Tax.TransactionLineItem.t())}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}

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

Details

  • Method: get
  • Path: /v1/tax/transactions/{transaction}/line_items
Link to this function

retrieve(transaction, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  transaction :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves a Tax Transaction object.

Details

  • Method: get
  • Path: /v1/tax/transactions/{transaction}