#karsh
1 messages ยท Page 1 of 1 (latest)
Perhaps this link helps https://dashboard.stripe.com/test/logs/req_3IAGElforZeyTS
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
๐ Thanks for reaching out
Thanks for sharing the failed request Id, let me check
Still looking into it as this feature is still beta
Thanks ๐
๐ taking over for my colleague. Let me catch up.
when you created the order you enabled automatic_tax and you specified a customer and billing address so Stripe calculated the tax for you
by then you can't override the tax
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
before this request tax_details wasn't set
and when you specified the customer then it was calculated and added
Thanks! Can I add a customer without it trying to calcualte tax automatically?
I guess I can do so by disabled automatic_tax?
That would still allow me to add the tax details and have it calculate the tax amount?
yes that's true if you want to calculate the tax by yourself then you would need to disable the automatic_tax
but once it get calculated there's no going back from there
Hmm I don't want to calculate the tax myself though, but I want it to only calculate the tax AFTER adding a tax id
Else we don't know if they should be exempted or not
how would I do that
when I say calculated I mean the tax details and not the tax itself
my bad, it was a poor choice of word
No worries!
I'll try without automatic tax right now and see if that gives me the desired result
I think I don't understand it completely yet.
When I disable automatic tax when creating the order, it doesn't calculate any tax (as instructed) https://dashboard.stripe.com/test/logs/req_JN0w3GNJrn5RB1
the total_details.amount_tax is 0
I swear I had it working like this before:
- create order with automatic tax enabled
- update order with billing country (this allows it to calculate tax)
- update order with tax id
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Just tried it again, this DOES work:
Updated order with tax amount 0 (exempted), after applying a tax idhttps://dashboard.stripe.com/test/logs/req_srPbCDO87gr80C
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
So the difference is that now I'm trying to:
- create order with automatic tax enabled
- update order with billing country (this allows it to calculate tax)
- update order with a customer
- update order with tax id
With this sequence, it throws the error at step 4
Adding a customer also sets a tax id?
Yes, the order will use tax_ids set on the Customer object:
If you do pass a Customer that has either tax_ids or tax_exempt, these values get copied into the tax_details hash of the order and are applied to the automatic tax calculation.
https://stripe.com/docs/orders/tax#tax-details
So I should just not add a customer until after I have updated the order with a tax id?
No, I'd assume you'll still have the same issues (trying to apply tax_ids when they're already been used to calculate the tax due)
Can you not just unset the tax_ids on the Customer?
Or update them?
Maybe? I want the user to be able to supply a tax id for each order. As they could be buying products for different companies, with different tax ids
I'd recommend just updating the Customer object before applying it to the order in that case
Maybe it helps to explain my goal: I'm trying to replicate the behaviour that Stripe Checkout has.
- Select a country
- input a tax id
- If tax id is valid, and exempt: show 0 tax.
- If you change the tax id again, make it invalid: show full tax again
Regardless of the customer object - the error says you can't update an order tax details once set.
Does this mean that it's simply impossible to replicate the behaviour as seen in the video I just sent?
You can't compare to Checkout here really. It doesn't use the Orders API
And has internal APIs for tax calculation
I see, so I can't expect to replicate that behaviour completely with the orders api...
I'm not sure, did you try what I described?
Then for your suggestion to unset the tax_id:
In this case I'm creating a new customer: https://dashboard.stripe.com/test/logs/req_7GHmoRGBrHXEAd
however it still throws the error that there's already a tax id set
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
order_1Lnh5nKWokmZWsWfbz7WM9bO
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Did you try doing it the other way? Set the tax_details, then add a customer?
No, can try that now
Throws the same error, but now on the adding a customer https://dashboard.stripe.com/test/logs/req_S66nvrFiTTRFua
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
with a new customer that doesn't have any tax ids set (unless I'm looking at the wrong location here)
Then I guess it isn't achievable in the way you expect
What about adding the automatic_tax parameter only after you've set the cus_xxx and Tax IDs as you need?
I appreciate all the advice so far, I feel like you're truly helping me get to a solution by thinking with me.
I'm thinking about that, but if I dsiable the automatic_tax param, I don't get total_details.amount_tax so I can't display that on the page yet.
Which I would like to do, I'd like to show a subtotal and total, example:
subtotal: 100
VAT (21%): 21
total: 121
Maybe there is a way for me to get the amount_tax value still? Or this is 100% only happening when automatic_tax is enabled?
Right, but once the tax IDs are set and then you apply the parameter, the response should have the tax totals
You could use Tax Rates: https://stripe.com/docs/api/orders_v2/create#create_order_v2-line_items-tax_rates
But I imagine same issues will still apply
Ahh this doesn't work out I think practically... Maybe I'm missing something...
The flow I'm building is, similarly to checkout again ;-), that I'd like to show the default VAT rate (21% in this case) and only take it away after the user optionally adds their tax id
Many users won't add a tax id at all
Then I guess that isn't possible
The only solution I can see right now is that I save the tax rate somewhere (probably within the line items as you just sent me) and then show that on the page with my own code.
Then only after somebody applies a tax id, then we activate automatic tax
Hmm, I still think you'll have the same issues (i.e. not able to update the tax IDs as a tax calculation will have taken place)
Tax Rates are fundamentally the same thing โ a way of calculating tax. They're just not automatic like Stripe Tax (i.e. you need to apply the tax rates according to the location of your customer)
Hmmmm then the only soltuion I see right now is to not update the order with a customer at all, I guess it's not absolutely necessary. I don't really know the benefit of it to be honest
Without updating the order with a customer, teh user can at least apply a tax id once. They still need to completely redo their checkout if they want to change it though
I still don't think you can update tax_ids on an order, regardless of whether a Customer is involved
yeah that does work, I think the issue really lies in the customer object somehow. Even if the customer is new, it has one of these 2 things set I guess...
Hang on I'll show you that it works to update a tax_id on an order
Sounds like a solution then!
This is my ui in the vid.
This is before upadting the tax id https://dashboard.stripe.com/test/logs/req_9bWus2v1YRxetJ
This is the order after updating https://dashboard.stripe.com/test/logs/req_aR5sMRRm2p7k09
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Then i'd like to try deliberately unset the customer tax_id and tax_exempt status, when I create a customer. How do I do this?
You'd pass an empty string to those parameters in the update call
Doesn't work, seems like "none" is the default. And I think that is causing a problem because it considers the tax_details to be set once it's none
Ah, yeah. tax_exempt is an enumeration: https://stripe.com/docs/api/customers/update#update_customer-tax_exempt
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay I give up, I'll not add a customer to the order.
THen my last questions:
-
Not adding the customer to the order makes us not know which customer is linked to which order (in the stripe dashboard) I assume... I can compensate this by saving this all in our own database. Does it have any other effects to add a customer to an order?
-
I am trying the orders api beta, because it gives us stripe tax + custom checkout flows. I feel like my issues now stem from limitations that have yet to be fixed. How do I find out if this is true? Then I know what to expect from the orders API in the future