The Cards API provides a set of endpoints for you to manage cards on file. You can retrieve card information, list cards on file, and disable a card.
If your application has a card ID, it calls the RetrieveCard endpoint to get information about the associated card.
Retrieve card
The Cards API returns a response like the following example:
{
"card": {
"id": "ccof:uIbfJXhXETSP197M3GB",
"billing_address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"locality": "New York",
"administrative_district_level_1": "NY",
"postal_code": "10003",
"country": "US"
},
"bin": "411111",
"card_brand": "VISA",
"card_type": "CREDIT",
"cardholder_name": "Amelia Earhart",
"customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
"enabled": true,
"exp_month": 11,
"exp_year": 2018,
"last_4": "1111",
"prepaid_type": "NOT_PREPAID",
"reference_id": "user-id-1",
"version": 1
}
}
Call the ListCards endpoint to get a paginated list of information about the cards on file for the Square account associated with the access token provided in the request.
Your application can get all saved cards in a Square account or it can limit the response to cards for a customer, the state of a card, or both. Regardless of whether you filter by a customer ID, you can set a page size for the response pages.
The following request lists all the enabled cards for a given customer:
List cards
The Cards API returns a response like the following example:
{
"cards": [
{
"id": "ccof:uIbfJXhXETSP197M3GB",
"billing_address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"locality": "New York",
"administrative_district_level_1": "NY",
"postal_code": "10003",
"country": "US"
},
"bin": "411111",
"card_brand": "VISA",
"card_type": "CREDIT",
"cardholder_name": "Amelia Earhart",
"customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
"enabled": true,
"exp_month": 11,
"exp_year": 2024,
"last_4": "1111",
"prepaid_type": "NOT_PREPAID",
"reference_id": "user-id-2",
"version": 2
}
],
"cursor": "13SDKXRNKPJN48QDG3BGGFAK05P81653"
}
If your application has a card ID, it calls the DisableCard endpoint to disable a card on file. After a card is disabled, any request to the CreatePayment endpoint that references the disabled card returns an error.
Disable card
The Cards API returns a response like the following example:
{
"card": {
"id": "ccof:uIbfJXhXETSP197M3GB",
"billing_address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"locality": "New York",
"administrative_district_level_1": "NY",
"postal_code": "10003",
"country": "US"
},
"bin": "411111",
"card_brand": "VISA",
"card_type": "CREDIT",
"cardholder_name": "Amelia Earhart",
"customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
"enabled": false,
"exp_month": 11,
"exp_year": 2018,
"last_4": "1111",
"prepaid_type": "NOT_PREPAID",
"reference_id": "user-id-1",
"version": 2
}
}