Need an error on saving duplicate card

There is no option to restrict a user on adding duplicate card, can I validate a card by the following steps -

  1. Fetch all the added cards
  2. Save card on customer profile
  3. Compare the recent added card’s fingerprint, last4 digit, expiry month, expiry year with already added cards
  4. If any matched card found, we can delete the latest card and throw the error

Will this work?

:wave: Your right, we won’t restrict a customer from saving the card multiple times with your application. You can definitely validate a card with the information from a customer with the Cards API. :slightly_smiling_face:

Thanks Bryan. So shall we consider the below mentioned steps as a solution :

  1. Fetch all the added cards associated to the customer profile
  2. Save card on the customer profile
  3. Compare the recent added card’s fingerprint, last4 digit, expiry month, expiry year with already added cards
  4. If any matched card found, we can delete the latest card and throw the error

This might be helpful for other solution providers.

Yeah however I don’t think you need to fetch all added cards. You’ll just need to fetch all the cards associated to the customer profile. :slightly_smiling_face:

Oops, I forgot to mention that we need to fetch the cards of a particular customer. I will update my last post and thanks man for your quick and accurate responses.