#Big J - PaymentElement
1 messages · Page 1 of 1 (latest)
No problem, thanks for the help in advance!
Just curious, why do you update the amount after the paymentelement is loaded?
because in our UI, you can change the quantity of the item on the same page as the card payment inputs
so changing quantity triggers an api call, which then on the backend updates the payment intent (i pass the ID) and it all functions correctly, its just that then after doing that clicking apple pay or google pay, displays the wrong amount
atm i have gotten around it by reinitialising the payment element, but as you can imagine if i could avoid doing that it'd be amazing
Ah got it that makes sense
Looking
One thing you could do is ask for the quantity in your flow prior to loading the PaymentElement. Looking to see if there's a suitable alternative though
yeah, i figured thats how the elements intend to be used, but i see that there is an update method for payment request directly, i just wish i could access that via the payment element
Yeah so unfortunately the only solution here then is to reinitialize the PaymentElement (as you are currently doing). There is work in flight to add a simpler way of reloading the PaymentElement, but there's no current ETA for it. See: https://github.com/stripe/react-stripe-js/issues/246#issuecomment-995990774