Manage Customer Cards on File

Applies to: Cards API | Customers API | Payments API

Learn how to use the Cards API to retrieve a stored card, list the cards on file for a customer, and disable a card.

Link to section

Overview

The Cards API provides a set of endpoints you can use to manage credit and debit cards on file. You can retrieve card information using the RetrieveCard endpoint, list cards on file using the ListCards endpoint, and disable a card using the DisableCard endpoint.

Note

For information about how to save cards on file using the CreateCard endpoint, see How the API works. For information about how to use cards on file for payments, see Card-on-file payments.

Link to section

Get a card

To get information about a card on file, call RetrieveCard and provide the card ID. If needed, call ListCards to get the card ID.

Retrieve card

Link to section

List cards saved for a customer

To get a customer's cards on file, call ListCards and provide the customer ID. If you need to get the customer ID, call SearchCustomers and search by phone number, email address, or other supported attribute.

The following example request uses the customer_id query parameter to get the cards on file for a specified customer. The access token you provide in the request identifies the Square account where the cards are stored.

List cards

By default, only enabled cards are returned in the response. To also retrieve disabled cards, include the is_disabled query parameter in the request.

The response returns up to 25 cards. If there are more cards to retrieve, the response includes a cursor. Use this cursor in the cursor field of your next ListCards request to retrieve the next page of results.

Link to section

Disable a card

To disable a card on file, call DisableCard and provide the card ID. If needed, call ListCards to get the card ID.

Disable card

After a card is disabled, new CreatePayment requests that reference the disabled card return an error.

By default, only enabled cards are returned in a ListCards response. To also retrieve disabled cards, include the is_disabled query parameter in the request.

Link to section

See also