#Fire
1 messages · Page 1 of 1 (latest)
Hello! Yep, we have Stripe Tax for that, which works with Invoicing, Billing, Payment Links, and Checkout: https://stripe.com/docs/tax
I was readying about it, apparently I am supposed to have a list of products on my dashboard?
usually my products are saved on my database, and only use stripe to issue the payments
That's typically how it works, yes, you would define your product catalog using Products and Prices in Stripe.
If you don't want to do that you can specify ad-hoc Product and Price data for each payment.
How I want it to work is:
Create an intent with an amount of 200$ for example, and have stripe automatically calculate the taxes depending on the user's country
exports.createStripePayment = async (req, res) => {
try {
const {
items,
email,
name,
phoneNumber,
country,
city,
line1,
line2,
state,
postal_code,
} = req.body;
// const amount = await calculateOrderAmount(items);
const amount = 200;
const intent = await stripe.paymentIntents.create({
amount: amount,
metadata: { items: JSON.stringify(items) },
currency: "usd",
automatic_payment_methods: {
enabled: true,
},
receipt_email: email,
shipping: {
name: name,
phone: phoneNumber,
address: {
country: country,
city: city,
line1: line1,
line2: line2,
state: state,
postal_code: postal_code,
},
},
});
return Response.success(res, {
clientSecret: intent.client_secret,
});
} catch (err) {
console.log(err);
return Response.serverError(res, err.message);
}
};
this is my function if it helps, the amount is usually calculated depending on the items but for now im just testing
Stripe Tax is not compatible with creating Payment Intents directly.
Payment Intents are low-level objects that take a single amount, they are not tax-aware.
In order to use Stripe Tax you need to use something like Invoices or Checkout.
So I will need to duplicate my database of products and update it on both my dashboard and database in order to implement the automated taxes?
No. Let's say you wanted to use Checkout. You can specify ad-hoc Price and Product data using price_data when you create the Checkout Session: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data