#josula_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1372822588874555493
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- josula_basil-invoice-payment-intent, 1 day ago, 24 messages
this is how we currently determined and fetch the tax rates:
const taxRates = await stripe.taxRates.list({
limit: 2,
});
const appliedTaxRate = taxRates.data.find(
(taxRate) =>
taxRate.percentage ===
(cart.billing_address?.country_code?.toUpperCase() === "DE" ? 19 : 0)
);
I don't have to tell you that this is not very robust. If anyone changes the tax rates in the UI, this will break immediately. I would much rather have a internal ID that I know beforehand that I can use. I don't wanna use the ID of the tax rate itself because it could easily change and it also changes across environments.
the same problem as above goes for the invoice templates. From the documentation, I have no way of setting custom tag or anything.
No I dont' think you can update the taxrate percentage.see https://docs.stripe.com/api/tax_rates/update for the list of params availble for tax rate update
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
you are right about this one actually. But is this really the recommended way of doing this or do you know a smarter and more robot way to do this? This also does not solve the problem with the invoice templates across sandbox and production environment. I mean, I could technically fetch them by their name, but someone could just change it and then everything breaks.
Just trying to understand your concern. Do you worry that your integration will break due to a change of tax rate percentage?
so there is two problems at hand: I need to fetch both tax rates and my invoice templates. The cleanest way we do to do this by their IDs. so txr_.... and inrtem_abc. But I don't want to hardcoat these in my code. I want to have an identifier that is consistent across environments, and that cannot be changed by any dashboard user.
for example, even if I test my code in sandbox, I still need the 19% tax. In production, however this would be a different object with a different ID. The same is with the invoice templates. They would have different ideas across environments. I am thinking about the smartest way of fetching the correct tax rate or invoice template despite the environment that I'm currently executing the code from
const invoiceIDs = {
GERMANY: "inrtem_1ROhqOQWc5EeQut983IdMPcN",
EU: "inrtem_1ROhqOQWc5EeQut983IdMPcN",
};
I could do something like the code above. But this has several flaws: it ties my coat to a particular invoice ID and it only works for one environment. I mean, yes I could add the production IDs as well and then do a look up depending on what environment I'm in, but it feels incredibly wrong to do this.
I am wondering if you can think of any smarter way to dynamically fetch the correct tax rate and the correct invoice ID without knowing their IDs beforehand
Or would you say the "safest" way would be to hardcode the IDs and simply rely that they are not being deleted by anyone?
?
About "smarter way to dynamically fetch the correct tax rate and the correct invoice ID", how to define the "correct tax rate" and "correct invoice ID" ?