How can we check if the same customer card exists before saving it on file?

Hello, I’m saving the customer’s card on file when the client try to make a payment. But is there a method to check if the customer entered the same credit card twice so I don’t save the same card twice on square. Knowing that I don’t want to save the client credit card info in my database.
So in other words we want to insert the card on file if its new for the customer, but if he used it before we don’t want to insert it under the square’s customer id.

1 Like

Hello! There currently is not any to prevent storing a duplicate card on file.

If you retrieve the card that’s stored for a customer, you’ll see it has a fingerprint property which can be used to identify if a customer has multiples of the same card stored. Unfortunately there is no way to check this until after the card has been stored with CreateCard.

1 Like

So each time I want to make the customer pay manually, I need to save his card on file.
My question now is: How much credit cards per customer can we store per customer (especially in production mode) and can we permanently delete a card from the customer’s card list?

Also if there is a limit for cards per customer and I can’t delete permanently cards. Can we add cards more than the limit if we just disable some?

With the Cards API you can manage a customers card on file which includes the ability to DisableCard. :slightly_smiling_face:

Is there a limit for the number of cards per customer?

I believe the limit is around 10 cards per customer. Do you foresee that you would exceed that limit? :slightly_smiling_face:

what I was trying to say is that when a customer pay for a package I save his card on file on square ( I don’t want to save anything related to the card details in our database). I save the card because we have an auto renew feature.
But the customer can order another package: in this case he may enter the same card another time, so a new card will be saved in the customer’s square account with the same data. This card is duplicated.
I want to know if there is a method to delete the old one or at least not to save the new one if it exists.
So yes it may exceed 10 cards per user if the customer tried to purchase more than 10 times with the same card or with different card

If you know the customer the saved card is in the Square customer profile. You can then use that same card_id to charge the card on file. That way would wouldn’t have to have the customer enter their card information for every payment. :slightly_smiling_face:

Okay I can do that. but in case after 1 year for example the customer used 10 cards and all old cards are expired and he wants to add a brand new card and make a purchase. what should we do while the number of cards exceeds the limit?

Any expired card you should call DisableCard to remove it from the customer profile. :slightly_smiling_face:

Hi Bryan, am I correct in thinking that even if we used the same card as saved previously, multiple save attempts would just overwrite the single saved card and thus only use one slot?

Unfortunately, no. Each saved card even if it’s the same card will count as an individual saved card on file for the customer. :slightly_smiling_face: