I’m struggling to add GST (Tax) to my stripe checkout. totalBill is the final amount, but I want to add 10% GST (Australian Tax). What do I need to do to have it displayed and calculated in my Stripe Checkout?
Thanks in advance, pulling my hair out over this one!
const product = await stripe.products.create({
name: `Service for ${name} + GST`,
tax_code: "txcd_99999999",
});
const price = await stripe.prices.create({
currency: "aud",
unit_amount: totalBill * 100,
product: product.id,
});
if (price) {
const customer = await stripe.customers.create({
email: email,
name: name,
address: {
line1: addressLine1,
city: addressCity,
state: addressState,
postal_code: addressPostalCode,
country: addressCountry,
},
});
if (customer) {
session = await stripe.checkout.sessions.create({
payment_method_types: ["card"],
line_items: [
{
price: price.id,
quantity: 1,
},
],
customer: customer.id,
customer_update: {
address: "auto",
},
mode: "payment",
success_url: `URL`,
cancel_url: "URL",
});
const customerid = customer.id;
customerStripeURL = `https://dashboard.stripe.com/customers/${customerid}`;
}
You should create a tax rate for GST first, and specify the resulting tax rate ID in the line_times.tax_rates during checkout session creation.