#thegeneral1926

1 messages · Page 1 of 1 (latest)

cyan swanBOT
sacred vault
#

Hi, can you share what you expect to see vs. what you're seeing?

#

This is something you'd handle, but trying to help unblock you with best practices.

gaunt frigate
#

Sure, I have stripe payment element on my website at the moment, and want to have the payment summary display showing something like "Price" "Tax" "Total", etc. (something like the second screenshot)

And since I've used Stripe Tax Api to get TaxCalculation and attached TaxCalculation on PaymentIntent and return client secret of the PaymentIntent, I only have client secret on the frontend side. So I would like to know what's the best practice to get those summary information

#

The second screenshot does not have 'Tax' item but i think you'll see what i meant

#

The thing i want to avoid is calculating tax from frontend since I use Stripe Tax api to calculate it

sacred vault
#

Yeah, that second screenshot looks to be our Stripe Checkout UI. You're trying to display a breakdown of the total for the payment. This is something you'd handle on your end before rendering the payment Element. You're making these calculations on the server side so you do have all of the information you need to create this UI.

#

I do not follow what you mean with this 'The thing i want to avoid is calculating tax from frontend since I use Stripe Tax api to calculate it'. Are you able to clarify?

gaunt frigate
#

Hmm actually you can ignore that one, since there is tax information on server side (kinda dumb question in hindsight)

So do you think it's best practice to create some endpoint like "getClientSecretAndPaymentSummary" and call it on frontend when loading the PaymentElement

sacred vault
#

I would have a summary page before you render the PaymentElement.

gaunt frigate
#

ok but in that case i don't have the information of tax amount prior to PaymentElement because tax amount is calculated when creating PaymentElement, unless I calculate tax amount on the frontend side separately (which I want to avoid)

#

well... actually it was another dumb statement from me, i think i can create separate endpoint for tax calculation and use it on frontend to display the summary

#

alright (was thinking about if i have to ask more questions) i think it's good right now. Thanks for the help!