Validate Cards on File

I’m just starting my development with Square and I have a few questions with how Cards on File work.

Once a month I need to charge a customer’s card, is there a way to verify the card on file has not expired before using it for payment? Ideally I’d like to verify cards a few days ahead to give the customer a heads up if their card has expired, give them a chance to update their card.

I guess I could perform a small authorization only transaction a day or two ahead, would that be a good idea or a poor idea? Does that incur a charge for the transaction from Square, or does that only happen when a payment is captured?

I don’t suppose there is a portal for the customer to maintain their cards on file?

Well, that’s it for my first question in the new forums.


Hey Russ, thanks for checking out our new forums :slight_smile:

There’s no authorization endpoint, however you could do a Delayed Capture a few days before and complete the payment on the day of. This will basically get payment approval, but not charge the card, so you’ll know if it will succeed or not. Then, if it fails, you could alert the customer that their card on file seems to be invalid and they should update it to continue making payments.

Just curious @RussPete, are you just asking to know if the card’s expiration date? If so, the Create Customer Card endpoint returns expiration month and year for cards (and it does validate the card number when storing a card on file).

Thanks @dpapastrat, I hadn’t seen those fields returned yet, I was thinking only the card id would be returned. I can keep the additional information that is returned and make use of it, keep track of the expiration date on my own.


Believing that this questions add’s to original posters question, is it possible that a customer has more than one card on file?
If so, what is best practice for choosing a saved card to charge?
Assuming using the API for search and charge.

Yes, it is possible for a customer to have more than one card on file; however, from an API point of view, you can only charge cards on file that your app has created. You’ll need to store a reference to that card in your own database - there’s no ability to list / search for cards on file today.

Thanks for the clarification, we have to store “reference_id”: “YOUR_REFERENCE_ID” for the card that the API created in our system to be able to charge it for recurring payments.

Since we can only get the cards that the API created, is it possible for the API to save more than one card for the customer? If so, I assume we check which one of the referenced cards is valid for the next payment.

The reference_id mentioned above is the customer reference, I presume the saved card ID would have to be stored at the merchant Database.

It is possible for the API to save more than one card, yes. You’ll need to the ID of those cards in your own database, though - there’s no way to list / retrieve them from the API after they’ve been created.