#ram._777
1 messages ยท Page 1 of 1 (latest)
Can you illustrate this scenario in an example?
sure, I started with something like this:
stripe.checkout.sessions.create({
customer: customerId,
mode: "subscription",
line_items: [
{
price: priceId,
quantity: 1,
},
],
payment_method_collection: "if_required",
This worked well, but I need to add a tax rate for one specific country. I registered the tax rate on the dashboard and added it on dynamic_tax_rates in the line_item. However, I got an error that only some countries are supported (the documentation mentions it too).
https://stripe.com/docs/billing/taxes/collect-taxes?tax-calculation=tax-rates
so the problem is- I need to add taxes dynamically (based on the country input in the payment form), but couldn't find documentation on the right way to do it
If the country is not supported, I'm afraid it will not be possible in Checkout Session.
The only possible way to is to use Subscription API directly which the shipping / billing address / country is collected first, then determine the tax rate to be applied: https://stripe.com/docs/billing/taxes/collect-taxes?tax-calculation=tax-rates#static-configuration
ok, so i need ti implement the form myself?
I've already started to do that so 2 related questions if that's ok:
- Can I use the address element to only include the country? (and listen to that in my client in order to change the tax when needed, alternatively listen to changes in the payment element's country select)
- What's the correct way to update a subscription (and invoice and payment intent) tax rate? I tried a few ways but ended up just creating a new subscription with every plan/tax rate change
- Is there a way for me to show the actual amount needed to pay (hopefully with tax etc using Stripe Elements? (or do i have to fetch that info and render it myself?)
thanks for the quick response btw! I tried emailing this question to support and got no relevant responses
- Can I use the address element to only include the country? (and listen to that in my client in order to change the tax when needed, alternatively listen to changes in the payment element's country select)
Address Element is meant to full address and can't be just collecting country only. You can use own text box to create country only.
- What's the correct way to update a subscription (and invoice and payment intent) tax rate? I tried a few ways but ended up just creating a new subscription with every plan/tax rate change
If the invoice is finalised, the tax rate can't be changed. However, the tax rate update on the subscription will be applied to the next invoice.
For updating the plan, you can refer to the guide here: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
- Is there a way for me to show the actual amount needed to pay (hopefully with tax etc using Stripe Elements? (or do i have to fetch that info and render it myself?)
Those information should be fetched and render yourself with Element integration
thanks!
regarding 2- I actually think now recreating the subscription is not an option because it then rerenders the form and resets the country select
what's the right way to do that? I can't add my own select box because the tax application needs to match the one on the stripe form
You can disable the country selection in the Payment Element by setting it to never and only uses the one provided in your own select box: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-fields-billingDetails
ok thanks, that sounds like it can work (I can break the flow in two, first collecting the billing address and then create the subscription with static tax)
another question- can i create a checkout session strictly without a country selector?
I'm afraid that's not possible in Checkout Session
thank you
one last question if that's ok: is there an option I might have missed with only collection country in AddressElement?
As mentioned earlier, Address Element is meant for collecting full address and can't be just collecting country only