#sushbhat
1 messages ยท Page 1 of 1 (latest)
Hello ๐
I believe you could use elements.fetchUpdate() client-side to retrieve updates made to the PaymentIntent https://stripe.com/docs/js/elements_object/fetch_updates
ok, but how do I update the paymentintent details from client side?
our client just has clientsecret with it
If the cart changes then you'd call your own backend which can use the server-side library to update the PaymentIntent accordingly
https://stripe.com/docs/api/payment_intents/update?lang=php
And once that is successful, you'd use elements.fetchUpdate()
backend needs paymentintent id right to update payment intent object details? but client doesn't have paymentintent so wondering how can backend know which paymentintentid to update
the text before _secret_ in the client secret should be the PaymentIntent ID
oh I see..
An alternative would be to return the whole PaymentIntent object to client-side when you create it and store the PaymentIntent ID in your local state or a variable
and after elements.fetchUpdate will client secret change?
It shouldn't, no.
ok, one more thing how does elements.fetchUpdate() know which paymentintent changes to fetch on client side? does it internally look up based on client secret?
It will look it up based on the secret, yes.
thanks!
๐