#umairasif7-PaymentMethod
1 messages · Page 1 of 1 (latest)
Hi, it depends on your current integration
Could you elaborate on your logic which is creating PaymentMethod?
First setup intent API gets called, then a code(client_secret) passes to create card element, and after that payment code passes to create payment method API
And each time when customers input same card info, it created different PaymentMethods and you want to avoid, correct?
Did you tight the PaymentMethods to a same Customer?
Yes, PaymentMethods was tied to the same Customer.
I think the only information you could obtain are probably the last 4 digits/exp_year/exp_month (And it's great that way because you are not exposing to PCI Compliance). So whenever you create a new PaymentMethod, you can list current Customer's PaymentMethods last4/exp_year/exp_month and check for duplication
last4/exp_year/exp_month are these unique for each card?
Then instead of creating a new PaymentMethod, circle back to frontend and display a popup to your customer "Hey we notice you registered a xxx0000 card. Might be a same card?"
No it's not guaranteed, but it's good enough to confirm back the customer
Def not guaranteed unique
Those information lives here: https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-last4
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Alright.
This validation will be implemented during confirmCardSetup process?
Yeah, but TBH I am not sure if you can list PaymentMethods from client. You might need a roundtrip to backend, then list the PaymentMethods backend
Yeah, you are right.