#d0minat0r

1 messages · Page 1 of 1 (latest)

hazy frigateBOT
mossy plume
#

Let's say they finished the 1st payment, when you inspect the customer, do you see the previous used PaymentMethod?

serene imp
#

Yes it is there

#

It is not set as the default method tho, not sure if that is important

mossy plume
#

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

serene imp
#

Alright, I shall try that. Thank you

serene imp
#

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

mossy plume
#

You want to AJAX to your server instead and let the server confirm with the chosen PaymentMethod Id