#louis-tam_api

1 messages ¡ Page 1 of 1 (latest)

hexed edgeBOT
#

👋 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/1237843344332423289

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

zinc rune
#

Hello

#

When you say "hosted checkout page" you mean Stripe Checkout, correct?

tepid radish
#

Hi Bismarck, you mean like this? const lineItems = products.map((product) => ({
price_data: {
currency: "cad",
product_data: {
name: product.name,
},
unit_amount: Math.round(product.price * 100), // Ensure price is in cents
},
tax_rates: taxRate.percentage,
quantity: product.qty,
}));

//calculate tax
const taxRate = await stripe.taxRates.create({
display_name: "Ontario HST",
description: "Harmonized Sales Tax for Ontario",
percentage: 13,
jurisdiction: "CA", // Jurisdiction code for Canada
inclusive: false,
});

zinc rune
#

Nope, not the percentage -- you just pass the ID and it will apply the percentage. Also it is an array

#

So: tax_rates: [taxRate.id],

#

To be clear, you have to create the tax rate prior to creating the Checkout Session

tepid radish
#

oh got it.I thought you had to pass that in the session not the line items. It works now thanks!