#leboy_api

1 messages ยท Page 1 of 1 (latest)

knotty agateBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1261321664961183746

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

proven patio
#

We're not really familiar with the dashboard in here. We just help with the api

#

Can you share a screenshot so I can see what you're referring to?

#

And can you share a payment intent id where origin shows as united states when billing address isn't based in the US?

oblique tendon
#

Hi, thank you for the quick answer! A colleague of me just replied, we've found the issue.

Is it ok if I ask another question regarding the Stripe API?

proven patio
#

Sure

oblique tendon
#

We only use the credit card element in our checkout.

In the backend I use following three Stripe functions/endpoints:

  • stripe.prices.list()
    = receive the product with the unit_amount and currency

  • stripe.tax.calculations.create()
    = pass the unit_amount and currency => receive the amount_total (taxes are added or not depending on the user country)

  • stripe.paymentIntents.create()
    = pass in amount_total and currency

Then I pass the clientSecret returned from stripe.paymentIntents.create() to the frontend.

Is this the correct way to use these endpoints?

I mean why does the prices.list() isn't able to return the correct price based on the users address already is there maybe a more fitting endpoint? I'm not sure if this is "best practice" as it feels weird to do an extra API call to do tax calculation since this is extremely important to charge the user the correct amount incl. or excl. taxes

hidden pine
#

Hi ๐Ÿ‘‹ jumping in as my teammate needs to step away. Yes, that sounds like the correct flow for a Payment Intent integration that also needs to calculate tax amounts.

prices.list() only returns existing Price objects, which don't dynamically adjust for tax based on customer location because they don't have that context (nor are they expected to).

oblique tendon
#

Ok, if this seems like the correct workflow I'm fine with it

#

just wanted to double check in case there is a more efficient solution

#

thanks!