View Source Stripe.Tax.Calculation (stripity_stripe v3.3.1)
A Tax Calculation allows you to calculate the tax to collect from your customer.
Related guide: Calculate tax in your custom payment flow
Summary
Types
The address from which the goods are being shipped from.
Details about the customer, including address and tax IDs.
Details about the address from which the goods are being shipped.
Shipping cost details to be used for the calculation.
The tax.calculation type.
Functions
Calculates tax based on the input and returns a Tax Calculation object.
Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
Retrieves a Tax Calculation object, if the calculation hasn’t expired.
Types
@type address() :: %{ optional(:city) => binary() | binary(), optional(:country) => binary(), optional(:line1) => binary() | binary(), optional(:line2) => binary() | binary(), optional(:postal_code) => binary() | binary(), optional(:state) => binary() | binary() }
The address from which the goods are being shipped from.
@type customer_details() :: %{ optional(:address) => address(), optional(:address_source) => :billing | :shipping, optional(:ip_address) => binary(), optional(:tax_ids) => [tax_ids()], optional(:taxability_override) => :customer_exempt | :none | :reverse_charge }
Details about the customer, including address and tax IDs.
@type line_items() :: %{ optional(:amount) => integer(), optional(:metadata) => %{optional(binary()) => binary()}, optional(:product) => binary(), optional(:quantity) => integer(), optional(:reference) => binary(), optional(:tax_behavior) => :exclusive | :inclusive, optional(:tax_code) => binary() }
@type ship_from_details() :: %{optional(:address) => address()}
Details about the address from which the goods are being shipped.
@type shipping_cost() :: %{ optional(:amount) => integer(), optional(:shipping_rate) => binary(), optional(:tax_behavior) => :exclusive | :inclusive, optional(:tax_code) => binary() }
Shipping cost details to be used for the calculation.
@type t() :: %Stripe.Tax.Calculation{ amount_total: integer(), currency: binary(), customer: binary() | nil, customer_details: term(), expires_at: integer() | nil, id: binary() | nil, line_items: term() | nil, livemode: boolean(), object: binary(), ship_from_details: term() | nil, shipping_cost: term() | nil, tax_amount_exclusive: integer(), tax_amount_inclusive: integer(), tax_breakdown: term(), tax_date: integer() }
The tax.calculation type.
amount_totalTotal amount after taxes in the smallest currency unit.currencyThree-letter ISO currency code, in lowercase. Must be a supported currency.customerThe ID of an existing Customer used for the resource.customer_detailsexpires_atTimestamp of date at which the tax calculation will expire.idUnique identifier for the calculation.line_itemsThe list of items the customer is purchasing.livemodeHas the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.objectString representing the object's type. Objects of the same type share the same value.ship_from_detailsThe details of the ship from location, such as the address.shipping_costThe shipping cost details for the calculation.tax_amount_exclusiveThe amount of tax to be collected on top of the line item prices.tax_amount_inclusiveThe amount of tax already included in the line item prices.tax_breakdownBreakdown of individual tax amounts that add up to the total.tax_dateTimestamp of date at which the tax rules and rates in effect applies for the calculation.
@type tax_ids() :: %{ optional(:type) => :ad_nrt | :ae_trn | :al_tin | :am_tin | :ao_tin | :ar_cuit | :au_abn | :au_arn | :aw_tin | :az_tin | :ba_tin | :bb_tin | :bd_bin | :bf_ifu | :bg_uic | :bh_vat | :bj_ifu | :bo_tin | :br_cnpj | :br_cpf | :bs_tin | :by_tin | :ca_bn | :ca_gst_hst | :ca_pst_bc | :ca_pst_mb | :ca_pst_sk | :ca_qst | :cd_nif | :ch_uid | :ch_vat | :cl_tin | :cm_niu | :cn_tin | :co_nit | :cr_tin | :cv_nif | :de_stn | :do_rcn | :ec_ruc | :eg_tin | :es_cif | :et_tin | :eu_oss_vat | :eu_vat | :gb_vat | :ge_vat | :gn_nif | :hk_br | :hr_oib | :hu_tin | :id_npwp | :il_vat | :in_gst | :is_vat | :jp_cn | :jp_rn | :jp_trn | :ke_pin | :kg_tin | :kh_tin | :kr_brn | :kz_bin | :la_tin | :li_uid | :li_vat | :ma_vat | :md_vat | :me_pib | :mk_vat | :mr_nif | :mx_rfc | :my_frp | :my_itn | :my_sst | :ng_tin | :no_vat | :no_voec | :np_pan | :nz_gst | :om_vat | :pe_ruc | :ph_tin | :ro_tin | :rs_pib | :ru_inn | :ru_kpp | :sa_vat | :sg_gst | :sg_uen | :si_tin | :sn_ninea | :sr_fin | :sv_nit | :th_vat | :tj_tin | :tr_tin | :tw_vat | :tz_vat | :ua_vat | :ug_tin | :us_ein | :uy_ruc | :uz_tin | :uz_vat | :ve_rif | :vn_tin | :za_vat | :zm_tin | :zw_tin, optional(:value) => binary() }
Functions
@spec create( params :: %{ optional(:currency) => binary(), optional(:customer) => binary(), optional(:customer_details) => customer_details(), optional(:expand) => [binary()], optional(:line_items) => [line_items()], optional(:ship_from_details) => ship_from_details(), optional(:shipping_cost) => shipping_cost(), optional(:tax_date) => integer() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Calculates tax based on the input and returns a Tax Calculation object.
Details
- Method:
post - Path:
/v1/tax/calculations
@spec list_line_items( calculation :: 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.CalculationLineItem.t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
Details
- Method:
get - Path:
/v1/tax/calculations/{calculation}/line_items
@spec retrieve( calculation :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves a Tax Calculation object, if the calculation hasn’t expired.
Details
- Method:
get - Path:
/v1/tax/calculations/{calculation}