#ilyoTheHorrid

1 messages · Page 1 of 1 (latest)

terse briarBOT
gloomy inlet
#

Hi! Let me help you with this.

frank blade
#

thank you, but how do I do it as part of the payment intent API call?

#

As part of this:

    const paymentIntent = await stripe.paymentIntents.create({
      amount: Number(amount) * 100,
      currency: 'usd',
      customer: stripeCustomer,
      payment_method: paymentMethods.data[0].id,
      off_session: true,
      confirm: true
    })
gloomy inlet
frank blade
#

So to make sure: I need to run stripe.tax.calculations.create and then use and use the result as the amount in checkout?

gloomy inlet
frank blade
#

I'm not sure how this answers my question.
What is the difference between using stripe.tax.transactions.createFromCalculation and stripe.tax.calculations.create ?

gloomy inlet
#

stripe.tax.calculations.create just calculates a theoretical number,
stripe.tax.transactions.createFromCalculation actually applies the calculation to a specific paymentintent.

frank blade
#

What do you mean by "a theoretical number"? This makes no sense. Why would you have an API is the calculation is not accurate?

#

If I do

paymentIntent = await stripe.paymentIntents.update(cart.paymentIntent, {
      amount: taxCalculation.amount_total,
      metadata: {calculation: taxCalculation.id},
    });

This is also applied to a specific paymentintent. So what is the difference?

gloomy inlet
#

Here, in stripe.tax.transactions.createFromCalculation you create a record for that tax calculation in your transactions. It helps with your reporting.

gloomy inlet
terse briarBOT
frank blade
#

Ah, ok, now I understand, than you.