Skip to content

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.

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 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.checkout.create_payment_link(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyModelRequired within parentExpand Create Payment Link — request body — body

Referenced models: Create Payment Link — 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 Payment Link — response body

Referenced models: Create Payment Link — response body

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

Create Payment Link — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
checkout_optionsModelOptionalExpand 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).
descriptionstringOptionalA 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_keystringOptionalA 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
orderModelOptionalExpand 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_notestringOptionalA 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_dataModelOptionalExpand 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_payModelOptionalExpand 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
FieldTypePresenceDescription and constraints
$objectRoot
errorsarrayOptionalAny errors that occurred during the request.
errors[]ModelEach itemExpand Get Shift — response body — errors item
payment_linkModelOptionalExpand Create Payment Link — response body — payment link
The created payment link.
related_resourcesModelOptionalExpand 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
FieldTypePresenceDescription and constraints
$objectRoot
accepted_payment_methodsJSONOptional
accepted_payment_methods (anyOf 1)ModelAlternativeExpand 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)nullAlternative
allow_tippingJSONOptional
allow_tipping (anyOf 1)booleanAlternativeIndicates whether the payment allows tipping.
allow_tipping (anyOf 2)nullAlternative
app_fee_moneyJSONOptional
app_fee_money (anyOf 1)ModelAlternativeExpand 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)nullAlternative
ask_for_shipping_addressJSONOptional
ask_for_shipping_address (anyOf 1)booleanAlternativeIndicates whether to include the address fields in the payment form.
ask_for_shipping_address (anyOf 2)nullAlternative
custom_fieldsJSONOptional
custom_fields (anyOf 1)arrayAlternativeThe custom fields requesting information from the buyer.
custom_fields (anyOf 1)[]ModelEach itemExpand Create Payment Link — request body — body checkout options custom fields array item
custom_fields (anyOf 2)nullAlternative
enable_couponJSONOptional
enable_coupon (anyOf 1)booleanAlternativeIndicates whether to include the `Add coupon` section for the buyer to provide a Square marketing coupon in the payment form.
enable_coupon (anyOf 2)nullAlternative
enable_loyaltyJSONOptional
enable_loyalty (anyOf 1)booleanAlternativeIndicates 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)nullAlternative
merchant_support_emailJSONOptional
merchant_support_email (anyOf 1)stringAlternativeThe email address that buyers can use to contact the seller.
Maximum length: 256
merchant_support_email (anyOf 2)nullAlternative
phone_collectionJSONOptional
phone_collection (anyOf 1)stringAlternativeIndicates 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)nullAlternative
redirect_urlJSONOptional
redirect_url (anyOf 1)stringAlternativeThe confirmation page URL to redirect the buyer to after Square processes the payment.
Maximum length: 2048
redirect_url (anyOf 2)nullAlternative
shipping_feeJSONOptional
shipping_fee (anyOf 1)ModelAlternativeExpand 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)nullAlternative
subscription_plan_idJSONOptional
subscription_plan_id (anyOf 1)stringAlternativeThe 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)nullAlternative

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
FieldTypePresenceDescription and constraints
$objectRootDescribes 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_idstringRequired within parentThe ID of the business location the checkout is associated with.
namestringRequired within parentThe ad hoc item name. In the resulting `Order`, this name appears as the line item name.
Maximum length: 255
Minimum length: 1
price_moneyModelRequired within parentExpand Create Payment — request body — body tip money
The price of the item.

Referenced models: Create Payment — request body — body tip money

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"}

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.