#d0minat0r
1 messages · Page 1 of 1 (latest)
Let's say they finished the 1st payment, when you inspect the customer, do you see the previous used PaymentMethod?
Yes it is there
It is not set as the default method tho, not sure if that is important
Okie, next time onward you can list all the PaymentMethod attached to the customer, and passed some information to your frontend, ie. last4, then display it in your frontend
with some hidden field of the payment method id pm_xxx
Then when you customer chose, you simple pass back the PaymentMethod Id to your backend
Alright, I shall try that. Thank you
I was able to do what you said although i want to make a small change so that I dont have to call the backend again to confirm the paymentIntent.
Right now I am confirming the payment from the frontend itself
const { error } = await stripe.confirmPayment({ elements, confirmParams: { // Make sure to change this to your payment completion page return_url: returnUrl } });
Is there a way I can modify this code to pass the paymentMethod id if the user selects to use a saved card?
I am using nextJs for my frontend btw and this is the @stripe/react-stripe-js library
No as you can see here https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams this JS will use elements information as the new PaymentMethod
You want to AJAX to your server instead and let the server confirm with the chosen PaymentMethod Id