#stickyou69
1 messages · Page 1 of 1 (latest)
Payment intent should only be created when customer is at checkout/payment page. It shouldn't be required when customer is adding products to the cart
but if they continue shopping
and add sonething to the cart
the payment intent will be wrong
I can cancel the intent every time they continue shopping
but the docs say to re-use them
(users are locked into checkout page when checking out)
say when they add something to the cart, I can update the intent
but the loaded page on the browser doesnt know this
what if they submit payment from an old tab?
Stripe will always charge the latest amount set on the Payment Intent
If you wish to show the amount correctly at client, elements.fetchUpdates() can be used
It'll pull the latest amount set
how often does it poll
But yes, even if you show $60, customer will still be charged $120 even if you don't show correct amount at client
Stripe always follow the amount set on the Payment Intent, not the amount displayed at client
how often does it poll
It's up to your business logic. After the payment amount is updated, your client should callelements.fetchUpdates()to update the display: https://stripe.com/docs/js/elements_object/fetch_updates
If the customer is on older tab, he/she will still be charged with new amount
ahh
I control the submit button
so I can check before submitting
if the page is displaying stale data
sounds good
Yup! This sounds right