tansengming / stripe-rails

A Rails Engine for integrating with Stripe
MIT License
753 stars 123 forks source link

Add tax_behavior to Price #222

Closed szechyjs closed 1 year ago

szechyjs commented 1 year ago

Adds the tax_behavior attribute to Price.

tansengming commented 1 year ago

For reference, I tested this by adding the following to plans.rb:

Stripe.price :taxable_gold do |price|
  price.name = 'Taxable Gold'
  price.unit_amount = 699
  price.tax_behavior = 'exclusive'
end

ran rake stripe:prepare

confirmed that the new price was created by running rails r "Stripe::Price.list"

{"id":"price_1MXrPVGoGT3tifUxaj3rDl0t","object":"price","active":true,"billing_scheme":"per_unit","created":1675538909,"currency":"usd","custom_unit_amount":null,"livemode":false,"lookup_key":"taxable_gold","metadata":{},"nickname":"taxable_gold","product":"prod_NISKS79G6mf8bs","recurring":null,"tax_behavior":"exclusive","tiers_mode":null,"transform_quantity":null,"type":"one_time","unit_amount":699,"unit_amount_decimal":"699"},
tansengming commented 1 year ago

thanks for the PR @szechyjs ! FYI it's been released as https://github.com/tansengming/stripe-rails/releases/tag/2.4.0