POST /v2/cards

Adds a card on file to an existing merchant.

Servers

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
source_id String Yes

The ID of the source which represents the card information to be stored. This can be a card nonce or a payment id.

verification_token String No

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

See the SCA Overview.

card Object Yes

Represents the payment details of a card to be used for payments. These details are determined by the payment token generated by Web Payments SDK.

card.exp_year Integer No

The four-digit year of the card's expiration date.

card.cardholder_name String No

The name of the cardholder.

card.exp_month Integer No

The expiration month of the associated card as an integer between 1 and 12.

card.fingerprint String No

Not currently set. Intended as a Square-assigned identifier, based on the card number, to identify the card across multiple locations within a single application.

card.card_brand String No

The card's brand.

card.prepaid_type String No

Indicates whether the Card is prepaid or not. The Card object includes this field only in response to Payments API calls.

card.reference_id String No

An optional user-defined reference ID that associates this card with another entity in an external system. For example, a customer ID from an external customer management system.

card.id String No

Unique ID for this card. Generated by Square.

card.customer_id String No

The ID of a customer created using the Customers API to be associated with the card.

card.last_4 String No

The last 4 digits of the card number.

card.version Integer No

Current version number of the card. Increments with each card update. Requests to update an existing Card object will be rejected unless the version in the request matches the current version for the Card.

card.enabled Boolean No

Indicates whether or not a card can be used for payments.

card.card_type String No

The type of the card. The Card object includes this field only in response to Payments API calls.

card.bin String No

The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API returns this field.

card.billing_address Object No

Represents a postal address in a country. The address format is based on an open-source library from Google. For more information, see AddressValidationMetadata. This format has dedicated fields for four address components: postal code, locality (city), administrative district (state, prefecture, or province), and sublocality (town or village). These components have dedicated fields in the Address object because software sometimes behaves differently based on them. For example, sales tax software may charge different amounts of sales tax based on the postal code, and some software is only available in certain states due to compliance reasons.

For the remaining address components, the Address type provides the address_line_1 and address_line_2 fields for free-form data entry. These fields are free-form because the remaining address components have too many variations around the world and typical software does not parse these components. These fields enable users to enter anything they want.

Note that, in the current implementation, all other Address type fields are blank. These include address_line_3, sublocality_2, sublocality_3, administrative_district_level_2, administrative_district_level_3, first_name, last_name, and organization.

When it comes to localization, the seller's language preferences (see Language preferences) are ignored for addresses. Even though Square products (such as Square Point of Sale and the Seller Dashboard) mostly use a seller's language preference in communication, when it comes to addresses, they will use English for a US address, Japanese for an address in Japan, and so on.

card.billing_address.address_line_3 String No

The third line of the address, if any.

card.billing_address.first_name String No

Optional first name when it's representing recipient.

card.billing_address.postal_code String No

The address's postal code.

card.billing_address.organization String No

Optional organization name when it's representing recipient.

card.billing_address.address_line_2 String No

The second line of the address, if any.

card.billing_address.address_line_1 String No

The first line of the address.

Fields that start with address_line provide the address's most specific details, like street number, street name, and building name. They do not provide less specific details like city, state/province, or country (these details are provided in other fields).

card.billing_address.administrative_district_level_3 String No

A civil entity within the address's administrative_district_level_2, if any.

card.billing_address.sublocality_2 String No

A civil region within the address's sublocality, if any.

card.billing_address.administrative_district_level_2 String No

A civil entity within the address's administrative_district_level_1. In the US, this is the county.

card.billing_address.locality String No

The city or town of the address.

card.billing_address.sublocality String No

A civil region within the address's locality, if any.

card.billing_address.last_name String No

Optional last name when it's representing recipient.

card.billing_address.administrative_district_level_1 String No

A civil entity within the address's country. In the US, this is the state.

card.billing_address.sublocality_3 String No

A civil region within the address's sublocality_2, if any.

card.billing_address.country String No

The address's country, in ISO 3166-1-alpha-2 format.

idempotency_key String Yes

A unique string that identifies this CreateCard request. Keys can be any valid string and must be unique for every request.

Max: 45 characters

See Idempotency keys for more information.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.