Square: Create Checkout
Square checkout.createCheckout: arguments, response, policy and SDK examples.
← Checkout operations · Get started
Operation square.createcheckout
Provider route: POST /v2/locations/{location_id}/checkouts. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”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["checkout"]["createCheckout"]>[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.checkout.createCheckout(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom 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.checkout.create_checkout(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.location_id | string | Required within parent | |
body | Model | Required within parent | Expand Create Checkout — request body — body |
Referenced models: Create Checkout — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Create Checkout — response body |
Referenced models: Create Checkout — response body
Schemas
Section titled “Schemas”91 more schemas are linked from the tables above, on the schema pages.
Create Checkout — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Defines the parameters that can be included in the body of a request to the `CreateCheckout` endpoint. |
additional_recipients | array | Optional | The basic primitive of a multi-party transaction. The value is optional. The transaction facilitated by you can be split from here. If you provide this value, the `amount_money` value in your `additional_recipients` field cannot be more than 90% of the `total_money` calculated by Square for your order. The `location_id` must be a valid seller location where the checkout is occurring. This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission. This field is currently not supported in the Square Sandbox. |
additional_recipients[] | Model | Each item | Expand Create Checkout — request body — body additional recipients item |
ask_for_shipping_address | boolean | Optional | If `true`, Square Checkout collects shipping information on your behalf and stores that information with the transaction information in the Square Seller Dashboard. Default: `false`. |
idempotency_key | string | Required within parent | A unique string that identifies this checkout among others you have created. It can be any valid string but must be unique for every order sent to Square Checkout for a given location ID. The idempotency key is used to avoid processing the same order more than once. If you are unsure whether a particular checkout was created successfully, you can attempt it again with the same idempotency key and all the same other parameters without worrying about creating duplicates. You should use a random number/string generator native to the language you are working in to generate strings for your idempotency keys. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). Maximum length: 192 Minimum length: 1 |
merchant_support_email | string | Optional | The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the seller. If this value is not set, the confirmation page and email display the primary email address associated with the seller's Square account. Default: none; only exists if explicitly set. Maximum length: 254 |
note | string | Optional | An optional note to associate with the `checkout` object. This value cannot exceed 60 characters. Maximum length: 60 |
order | Model | Required within parent | Expand Create Order — request body — body The order including line items to be checked out. |
pre_populate_buyer_email | string | Optional | If provided, the buyer's email is prepopulated on the checkout page as an editable text field. Default: none; only exists if explicitly set. Maximum length: 254 |
pre_populate_shipping_address | Model | Optional | Expand Create Customer — request body — body address If provided, the buyer's shipping information is prepopulated on the checkout page as editable text fields. Default: none; only exists if explicitly set. |
redirect_url | string | Optional | The URL to redirect to after the checkout is completed with `checkoutId`, `transactionId`, and `referenceId` appended as URL parameters. For example, if the provided redirect URL is `http://www.example.com/order-complete`, a successful transaction redirects the customer to: `http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx` If you do not provide a redirect URL, Square Checkout displays an order confirmation page on your behalf; however, it is strongly recommended that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow. Default: none; only exists if explicitly set. Maximum length: 800 |
Referenced models: Create Customer — request body — body address, Create Checkout — request body — body additional recipients item, Create Order — request body — body
Create Checkout — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Defines the fields that are included in the response body of a request to the `CreateCheckout` endpoint. |
checkout | Model | Optional | Expand Create Checkout — response body — checkout The newly created `checkout` object associated with the provided idempotency key. |
errors | array | Optional | Any errors that occurred during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
Referenced models: Create Checkout — response body — checkout, Get Shift — response body — errors item
Create Customer — request body — body address
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents 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_1 | JSON | Optional | |
address_line_1 (anyOf 1) | string | Alternative | 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). |
address_line_1 (anyOf 2) | null | Alternative | |
address_line_2 | JSON | Optional | |
address_line_2 (anyOf 1) | string | Alternative | The second line of the address, if any. |
address_line_2 (anyOf 2) | null | Alternative | |
address_line_3 | JSON | Optional | |
address_line_3 (anyOf 1) | string | Alternative | The third line of the address, if any. |
address_line_3 (anyOf 2) | null | Alternative | |
administrative_district_level_1 | JSON | Optional | |
administrative_district_level_1 (anyOf 1) | string | Alternative | A 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) | null | Alternative | |
administrative_district_level_2 | JSON | Optional | |
administrative_district_level_2 (anyOf 1) | string | Alternative | A civil entity within the address's `administrative_district_level_1`. In the US, this is the county. |
administrative_district_level_2 (anyOf 2) | null | Alternative | |
administrative_district_level_3 | JSON | Optional | |
administrative_district_level_3 (anyOf 1) | string | Alternative | A civil entity within the address's `administrative_district_level_2`, if any. |
administrative_district_level_3 (anyOf 2) | null | Alternative | |
country | JSON | Optional | |
country (anyOf 1) | Model | Alternative | Expand 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) | null | Alternative | |
first_name | JSON | Optional | |
first_name (anyOf 1) | string | Alternative | Optional first name when it's representing recipient. |
first_name (anyOf 2) | null | Alternative | |
last_name | JSON | Optional | |
last_name (anyOf 1) | string | Alternative | Optional last name when it's representing recipient. |
last_name (anyOf 2) | null | Alternative | |
locality | JSON | Optional | |
locality (anyOf 1) | string | Alternative | The 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) | null | Alternative | |
postal_code | JSON | Optional | |
postal_code (anyOf 1) | string | Alternative | The 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) | null | Alternative | |
sublocality | JSON | Optional | |
sublocality (anyOf 1) | string | Alternative | A civil region within the address's `locality`, if any. |
sublocality (anyOf 2) | null | Alternative | |
sublocality_2 | JSON | Optional | |
sublocality_2 (anyOf 1) | string | Alternative | A civil region within the address's `sublocality`, if any. |
sublocality_2 (anyOf 2) | null | Alternative | |
sublocality_3 | JSON | Optional | |
sublocality_3 (anyOf 1) | string | Alternative | A civil region within the address's `sublocality_2`, if any. |
sublocality_3 (anyOf 2) | null | Alternative |
Referenced models: Create Location — request body — body location country
Create Checkout — request body — body additional recipients item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents an additional recipient (other than the merchant) entitled to a portion of the tender. Support is currently limited to USD, CAD and GBP currencies |
amount_money | Model | Required within parent | Expand Create Payment — request body — body tip money The amount of money distributed to the recipient. |
description | string | Required within parent | The description of the additional recipient. Maximum length: 100 Minimum length: 1 |
location_id | string | Required within parent | The location ID for a recipient (other than the merchant) receiving a portion of the tender. Maximum length: 50 Minimum length: 1 |
Referenced models: Create Payment — request body — body tip money
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.createcheckout. Catalog operation: CreateCheckout. 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: ["ORDERS_WRITE", "PAYMENTS_WRITE"]
Pinned headers: {"Square-Version": "2026-11-18"}