#Parth R. Jangid (Pseudo Bugs)
1 messages · Page 1 of 1 (latest)
hello! you'll need to implement your own logic to validate if the card already exists and is attached to the Customer. You can do that by checking the card's fingerprint : https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-fingerprint
I don't mind doing that but can you guide me a little on how to accomplish it. Like I will check fingerprint correct but like how? Do I create a card on iOS app then pass some token to backend and fetch my user's current payment methods and check one by one or like how?
You can take your time no hurry. Just want a little drection to move ahead
If you're using the paymentsheet, existing payment methods will already be displayed for the customer to select from. In such cases, the customer usually wouldn't add the same PaymentMethod again.
If you want to do so though...
if you're creating a PaymentIntent with setup_future_usage as off_session and also provide a customer id, the card will immediately be attached to the customer upon successful payment.
If you want to collect the card first to validate if the customer already has that card attached to them, then you would use SetupIntent to collect those details, but do not pass a Customer id in (you can pass it in the metadata so that it's easy to check).
you can use retrieve the customer's PaymentMethods using https://stripe.com/docs/api/payment_methods/customer_list and compare the fingerprint to check if it already exists.
If it does not already exist, you can then attach the PaymentMethod to the customer.
Understood a little. I am just figuring it out so if possible don't shut this thread down
Hi Alex,
So when you say you would use SetupIntent to collect those details, where and how do I collect details and confirm this setup Intent?
So basically do I create a setupIntent on my backend and then pass the client secret on front end or is it the other way around?
Pardon me the question may sound very stupid as I don't know much about this
Hi Alex,
Can you let share something on this?
you'd probably want to look at this page on how to save payment methods : https://stripe.com/docs/payments/save-and-reuse.
sure, you can share what you want to in this thread