Skip to content

Square: Create Customer Card

Square customers.createCustomerCard: arguments, response, policy and SDK examples.

← Customers operations · Get started

Operation square.createcustomercard

Provider route: POST /v2/customers/{customer_id}/cards. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/square with npm, or alter-sdk-square with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { SquareIntegration } from "@alter-ai/square";
async function execute(input: Parameters<SquareIntegration["customers"]["createCustomerCard"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new SquareIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.customers.createCustomerCard(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_square import SquareIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = SquareIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.customers.create_customer_card(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.customer_idstringRequired within parent
bodyModelRequired within parentExpand Create Customer Card — request body — body

Referenced models: Create Customer Card — request body — body

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Create Customer Card — response body

Referenced models: Create Customer Card — response body

3 more schemas are linked from the tables above, on the schema pages.

Create Customer Card — request body — body
FieldTypePresenceDescription and constraints
$objectRootDefines the fields that are included in the request body of a request
to the `CreateCustomerCard` endpoint.
billing_addressModelOptionalExpand Create Customer — request body — body address
Address information for the card on file.

__NOTE:__ If a billing address is provided in the request, the
`CreateCustomerCardRequest.billing_address.postal_code` must match
the postal code encoded in the card nonce.
card_noncestringRequired within parentA 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. For more information, see
[Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment).

__NOTE:__ Card nonces generated by digital wallets (such as Apple Pay)
cannot be used to create a customer card.
cardholder_namestringOptionalThe full name printed on the credit card.
verification_tokenstringOptionalAn identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
Verification tokens encapsulate customer device information and 3-D Secure
challenge results to indicate that Square has verified the buyer identity.

Referenced models: Create Customer — request body — body address

Create Customer Card — response body
FieldTypePresenceDescription and constraints
$objectRootDefines the fields that are included in the response body of
a request to the `CreateCustomerCard` endpoint.

Either `errors` or `card` is present in a given response (never both).
cardModelOptionalExpand Create Card — response body — card
The created card on file.
errorsarrayOptionalAny errors that occurred during the request.
errors[]ModelEach itemExpand Get Shift — response body — errors item

Referenced models: Create Card — response body — card, Get Shift — response body — errors item

Create Customer — request body — body address
FieldTypePresenceDescription and constraints
$objectRootRepresents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
address_line_1JSONOptional
address_line_1 (anyOf 1)stringAlternativeThe 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).
address_line_1 (anyOf 2)nullAlternative
address_line_2JSONOptional
address_line_2 (anyOf 1)stringAlternativeThe second line of the address, if any.
address_line_2 (anyOf 2)nullAlternative
address_line_3JSONOptional
address_line_3 (anyOf 1)stringAlternativeThe third line of the address, if any.
address_line_3 (anyOf 2)nullAlternative
administrative_district_level_1JSONOptional
administrative_district_level_1 (anyOf 1)stringAlternativeA civil entity within the address's country. In the US, this
is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
administrative_district_level_1 (anyOf 2)nullAlternative
administrative_district_level_2JSONOptional
administrative_district_level_2 (anyOf 1)stringAlternativeA civil entity within the address's `administrative_district_level_1`.
In the US, this is the county.
administrative_district_level_2 (anyOf 2)nullAlternative
administrative_district_level_3JSONOptional
administrative_district_level_3 (anyOf 1)stringAlternativeA civil entity within the address's `administrative_district_level_2`,
if any.
administrative_district_level_3 (anyOf 2)nullAlternative
countryJSONOptional
country (anyOf 1)ModelAlternativeExpand Create Location — request body — body location country
The address's country, in the two-letter format of ISO 3166. For example, `US` or `FR`.
See [Country](#type-country) for possible values
country (anyOf 2)nullAlternative
first_nameJSONOptional
first_name (anyOf 1)stringAlternativeOptional first name when it's representing recipient.
first_name (anyOf 2)nullAlternative
last_nameJSONOptional
last_name (anyOf 1)stringAlternativeOptional last name when it's representing recipient.
last_name (anyOf 2)nullAlternative
localityJSONOptional
locality (anyOf 1)stringAlternativeThe city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
locality (anyOf 2)nullAlternative
postal_codeJSONOptional
postal_code (anyOf 1)stringAlternativeThe address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
postal_code (anyOf 2)nullAlternative
sublocalityJSONOptional
sublocality (anyOf 1)stringAlternativeA civil region within the address's `locality`, if any.
sublocality (anyOf 2)nullAlternative
sublocality_2JSONOptional
sublocality_2 (anyOf 1)stringAlternativeA civil region within the address's `sublocality`, if any.
sublocality_2 (anyOf 2)nullAlternative
sublocality_3JSONOptional
sublocality_3 (anyOf 1)stringAlternativeA civil region within the address's `sublocality_2`, if any.
sublocality_3 (anyOf 2)nullAlternative

Referenced models: Create Location — request body — body location country

Get Shift — response body — errors item
FieldTypePresenceDescription and constraints
$objectRootRepresents an error encountered during a request to the Connect API.

See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information.
categorystringRequired within parentIndicates which high-level category of error has occurred during a
request to the Connect API.
The high-level category for the error.
See [ErrorCategory](#type-errorcategory) for possible values
Known values: API_ERROR, AUTHENTICATION_ERROR, INVALID_REQUEST_ERROR, RATE_LIMIT_ERROR, PAYMENT_METHOD_ERROR, REFUND_ERROR, MERCHANT_SUBSCRIPTION_ERROR, EXTERNAL_VENDOR_ERROR
codeModelRequired within parentExpand Get Shift — response body — errors item code
The specific code of the error.
See [ErrorCode](#type-errorcode) for possible values
detailstringOptionalA human-readable description of the error for debugging purposes.
fieldstringOptionalThe name of the field provided in the original request (if any) that
the error pertains to.

Referenced models: Get Shift — response body — errors item code

Create Location — request body — body location country
FieldTypePresenceDescription and constraints
$stringRootIndicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm).
One of: ZZ, AD, AE, AF, AG, AI, AL, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, YE, YT, ZA, ZM, ZW
Create Location — response body — location country
FieldTypePresenceDescription and constraints
$stringRootIndicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm).
Known values: ZZ, AD, AE, AF, AG, AI, AL, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, YE, YT, ZA, ZM, ZW

SDK function policy ID: square.createcustomercard. Catalog operation: CreateCustomerCard. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Required provider scopes: ["CUSTOMERS_WRITE"]

Pinned headers: {"Square-Version": "2026-11-18"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand how our website, product, and documentation are used.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

Advertising

Shares visits and sign-ups with Meta, Reddit, and X so we can measure which of our ads work.

You can change these choices at any time from Cookie settings.