#jonwaldstein
1 messages · Page 1 of 1 (latest)
Hello 👋
Do you mean after the user submits the form or before?
after they submit the form, so I can give this information to my back-end
Gotcha. In that case, you should be able to retrieve the PaymentIntent client-side and look at the payment method parameter (you may need to expand it)
https://stripe.com/docs/js/payment_intents/retrieve_payment_intent
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method
Actually I should mention i'm using the beta version where the payment intent is deferred. Is it possible to find the selected payment method before form submission?
Ah our team doesn't know a ton about the beta. However, you can listen to events on the payment element and look at the value property whenever you get the event
https://stripe.com/docs/js/element/events/on_change?type=paymentElement
it should reflect the payment method selected on the PaymentElement
How does that work with the react payment element using useElements() ?
oh wait I guess it would just be a prop on the component
yup I believe so like onChange or something..
great thjanks