#jainnikesh

1 messages · Page 1 of 1 (latest)

void sableBOT
broken fiber
#

Hi there, so you want to check if there's an existing payment_method that matches the card number of a newly created card payment method?

delicate coral
#

yes

#

exactly

#

it's adding duplicate card

delicate coral
#

??

#

threr

broken fiber
#

Hi, thanks for waiting, discord is busy today

#
  1. You can call Paymentmethod list API (https://stripe.com/docs/api/payment_methods/customer_list?lang=node#list_customer_payment_methods) to retrieve the payment methods that are already attached to a customer
  2. When you create a new payment method, you should check its card.fingerprint (https://stripe.com/docs/api/payment_methods/object?lang=node#payment_method_object-card-fingerprint) and see if it matches the fingerprints of any existing payment methods
  3. If there's no match, attach the new payment_method, abort otherwise.