Square: Create Payment Link
Square checkout.createPaymentLink: arguments, response, policy and SDK examples.
← Checkout operations · Get started
Operation square.createpaymentlink
Provider route: POST /v2/online-checkout/payment-links. 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"]["createPaymentLink"]>[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.createPaymentLink(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_payment_link(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | Model | Required within parent | Expand Create Payment Link — request body — body |
Referenced models: Create Payment Link — 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 Payment Link — response body |
Referenced models: Create Payment Link — response body
Schemas
Section titled “Schemas”144 more schemas are linked from the tables above, on the schema pages.
Create Payment Link — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
checkout_options | Model | Optional | Expand Create Payment Link — request body — body checkout options Describes optional fields to add to the resulting checkout page. For more information, see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). |
description | string | Optional | A description of the payment link. You provide this optional description that is useful in your application context. It is not used anywhere. Maximum length: 4096 |
idempotency_key | string | Optional | A unique string that identifies this `CreatePaymentLinkRequest` request. If you do not provide a unique string (or provide an empty string as the value), the endpoint treats each request as independent. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). Maximum length: 192 |
order | Model | Optional | Expand Create Order — request body — body order Describes the `Order` for which to create a checkout link. For more information, see [Square Order Checkout](https://developer.squareup.com/docs/checkout-api/square-order-checkout). |
payment_note | string | Optional | A note for the payment. After processing the payment, Square adds this note to the resulting `Payment` as well as the post payment confirmation email. Maximum length: 500 |
pre_populated_data | Model | Optional | Expand Create Payment Link — request body — body pre populated data Describes fields to prepopulate in the resulting checkout page. For more information, see [Prepopulate the shipping address](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#prepopulate-the-shipping-address). |
quick_pay | Model | Optional | Expand Create Payment Link — request body — body quick pay Describes an ad hoc item and price for which to generate a quick pay checkout link. For more information, see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). |
Referenced models: Create Payment Link — request body — body checkout options, Create Order — request body — body order, Create Payment Link — request body — body pre populated data, Create Payment Link — request body — body quick pay
Create Payment Link — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
errors | array | Optional | Any errors that occurred during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
payment_link | Model | Optional | Expand Create Payment Link — response body — payment link The created payment link. |
related_resources | Model | Optional | Expand Create Payment Link — response body — related resources The list of related objects. |
Referenced models: Get Shift — response body — errors item, Create Payment Link — response body — payment link, Create Payment Link — response body — related resources
Create Payment Link — request body — body checkout options
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
accepted_payment_methods | JSON | Optional | |
accepted_payment_methods (anyOf 1) | Model | Alternative | Expand Create Payment Link — request body — body checkout options accepted payment methods afterpay clearpay, apple pay, bank account, cash app pay, google pay The methods allowed for buyers during checkout. |
accepted_payment_methods (anyOf 2) | null | Alternative | |
allow_tipping | JSON | Optional | |
allow_tipping (anyOf 1) | boolean | Alternative | Indicates whether the payment allows tipping. |
allow_tipping (anyOf 2) | null | Alternative | |
app_fee_money | JSON | Optional | |
app_fee_money (anyOf 1) | Model | Alternative | Expand Create Payment — request body — body tip money The amount of money that the developer is taking as a fee for facilitating the payment on behalf of the seller. The amount cannot be more than 90% of the total amount of the payment. The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-monetary-amounts). The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller. For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/collect-fees/additional-considerations#permissions). |
app_fee_money (anyOf 2) | null | Alternative | |
ask_for_shipping_address | JSON | Optional | |
ask_for_shipping_address (anyOf 1) | boolean | Alternative | Indicates whether to include the address fields in the payment form. |
ask_for_shipping_address (anyOf 2) | null | Alternative | |
custom_fields | JSON | Optional | |
custom_fields (anyOf 1) | array | Alternative | The custom fields requesting information from the buyer. |
custom_fields (anyOf 1)[] | Model | Each item | Expand Create Payment Link — request body — body checkout options custom fields array item |
custom_fields (anyOf 2) | null | Alternative | |
enable_coupon | JSON | Optional | |
enable_coupon (anyOf 1) | boolean | Alternative | Indicates whether to include the `Add coupon` section for the buyer to provide a Square marketing coupon in the payment form. |
enable_coupon (anyOf 2) | null | Alternative | |
enable_loyalty | JSON | Optional | |
enable_loyalty (anyOf 1) | boolean | Alternative | Indicates whether to include the `REWARDS` section for the buyer to opt in to loyalty, redeem rewards in the payment form, or both. |
enable_loyalty (anyOf 2) | null | Alternative | |
merchant_support_email | JSON | Optional | |
merchant_support_email (anyOf 1) | string | Alternative | The email address that buyers can use to contact the seller. Maximum length: 256 |
merchant_support_email (anyOf 2) | null | Alternative | |
phone_collection | JSON | Optional | |
phone_collection (anyOf 1) | string | Alternative | Indicates how the buyer's phone number is collected on the checkout page. When `REQUIRED` (default), the buyer must provide a phone number to complete checkout. When `OPTIONAL`, the phone field is shown but not required. When `HIDDEN`, the field is not shown. Leaving this field unset preserves the historical behavior (`REQUIRED`). See [PhoneCollection](#type-phonecollection) for possible values One of: REQUIRED, OPTIONAL, HIDDEN |
phone_collection (anyOf 2) | null | Alternative | |
redirect_url | JSON | Optional | |
redirect_url (anyOf 1) | string | Alternative | The confirmation page URL to redirect the buyer to after Square processes the payment. Maximum length: 2048 |
redirect_url (anyOf 2) | null | Alternative | |
shipping_fee | JSON | Optional | |
shipping_fee (anyOf 1) | Model | Alternative | Expand Create Payment Link — request body — body checkout options shipping fee charge, name The fee associated with shipping to be applied to the `Order` as a service charge. |
shipping_fee (anyOf 2) | null | Alternative | |
subscription_plan_id | JSON | Optional | |
subscription_plan_id (anyOf 1) | string | Alternative | The ID of the subscription plan for the buyer to pay and subscribe. For more information, see [Subscription Plan Checkout](https://developer.squareup.com/docs/checkout-api/subscription-plan-checkout). Maximum length: 255 |
subscription_plan_id (anyOf 2) | null | Alternative |
Referenced models: Create Payment Link — request body — body checkout options accepted payment methods afterpay clearpay, apple pay, bank account, cash app pay, google pay, Create Payment Link — request body — body checkout options custom fields array item, Create Payment — request body — body tip money, Create Payment Link — request body — body checkout options shipping fee charge, name
Create Payment Link — request body — body quick pay
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Describes an ad hoc item and price to generate a quick pay checkout link. For more information, see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). |
location_id | string | Required within parent | The ID of the business location the checkout is associated with. |
name | string | Required within parent | The ad hoc item name. In the resulting `Order`, this name appears as the line item name. Maximum length: 255 Minimum length: 1 |
price_money | Model | Required within parent | Expand Create Payment — request body — body tip money The price of the item. |
Referenced models: Create Payment — request body — body tip money
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.createpaymentlink. Catalog operation: CreatePaymentLink. 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_READ", "ORDERS_WRITE", "PAYMENTS_WRITE"]
Pinned headers: {"Square-Version": "2026-11-18"}