#wjq8g6
1 messages ยท Page 1 of 1 (latest)
Hi ๐
What do you mean "StripePaymentForm"? What platform is this on? (Mobile, Web,, etc.)
This is the Payment Element for React in this doc (https://stripe.com/docs/payments/payment-element)
Ah, Payment Element. Thanks for clarifying
And do you run the Update function in your JS? https://stripe.com/docs/js/elements_object/update_payment_element
Oh we aren't using that function at the moment, we are updating the paymentIntent via stripe.paymentIntents.update. Should we use that update function instead? Looking at the doc, I'm not sure where we would include the amount update in the options argument
Hold on, I think you mistake how this works
Using the function you mentioned updates the Payment Intent on your server and with Stripe
but the Payment Element doesn't know it
Rung the JavaScript function I linked you to is how you let the Payment Element know about the updates to the Payment Intent
Gotcha, I'm looking at the parameters of that function you linked, but the fields seems to be related to business name, customer details, and terms. How would I structure that element.update call to update the payment element's payment intent?
Wait sorry, there are multiple update functions and I grabbed the wrong one ๐คฆโโ๏ธ
What you want is this one: https://stripe.com/docs/js/elements_object/fetch_updates
Because you initialize elements with the clientSecret so that's when the information about the Payment Intent is provided. This function updates the elements with any new data from the Payment Intent
Ahh I see, that makes sense. Will try it out, thanks!
Oh actually, quick question, is there an example for fetching the element in React? Right now we just add <PaymentElement/> directly to our render function
๐ Taking over this thread, catching up now
Here's how you can fetch updates in React: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements&client=react#fetch-updates
Gotcha, so we would use the useElements hook right?
Yes! the elements from useElements hook
Cool, thanks for the help!
No problem! Happy to help ๐