You are viewing an old version of the API
Create customer card

Adds a card on file to an existing customer

As with charges, calls to CreateCustomerCard are idempotent. Multiple calls with the same card nonce return the same card record that was created with the provided nonce during the first call.

Required permissions CUSTOMERS_WRITE

Path Parameters

Name Description
customer_id
string

Required

The Square ID of the customer profile the card is linked to.

Request Body

Name Description
card_nonce
string

Required

A card nonce representing the credit card to link to the customer.

Card nonces are generated by the Square Payment Form when customers enter their card information. See Embedding the payment form for more information.

NOTE: Card nonces generated by digital wallets (e.g., Apple Pay) cannot be used to create a customer card.

billing_address
Address

Address information for the card on file. Only the postal_code field is required for payments in the US and Canada.

cardholder_name
string

The full name printed on the credit card.

verification_token
string

An identifying token generated by SqPaymentForm.verifyBuyer(). Verification tokens encapsulate customer device information and 3-D Secure challenge results to indicate that Square has verified the buyer identity.

Response Fields

Name Description
card
Card

The created card on file.

errors
Error [ ]

Any errors that occurred during the request.

Examples

You are viewing an old version of the API
POST /v2/customers/{customer_id}/cards
cURL
  • cURL
  • Ruby
  • Python
curl https://connect.squareup.com/v2/customers/{customer_id}/cards \
  -X POST \
  -H 'Square-Version: 2019-11-20' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -d '{
    "card_nonce": "YOUR_CARD_NONCE",
    "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"
    },
    "cardholder_name": "Amelia Earhart"
  }'
Response JSON
{
  "card": {
    "id": "icard-card_id",
    "card_brand": "VISA",
    "last_4": "1111",
    "exp_month": 11,
    "exp_year": 2018,
    "cardholder_name": "Amelia Earhart",
    "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"
    }
  }
}

Share Feedback

Thanks for visiting the Square API documentation. What's on your mind?