Skip to content

Square: Create Payment

Square payments.createPayment: arguments, response, policy and SDK examples.

← Payments operations · Get started

Operation square.createpayment

Provider route: POST /v2/payments. 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["payments"]["createPayment"]>[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.payments.createPayment(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.payments.create_payment(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyModelRequired within parentExpand Create Payment — request body — body

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

Referenced models: Create Payment — response body

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

Create Payment — request body — body
FieldTypePresenceDescription and constraints
$objectRootDescribes a request to create a payment using
[CreatePayment](api-endpoint:Payments-CreatePayment).
accept_partial_authorizationbooleanOptionalIf set to `true` and charging a Square Gift Card, a payment might be returned with
`amount_money` equal to less than what was requested. For example, a request for $20 when charging
a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
payment. This field cannot be `true` when `autocomplete = true`.

For more information, see
[Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card).

Default: false
amount_moneyModelOptionalExpand Create Payment — request body — body tip money
The amount of money to accept for this payment, not including `tip_money`.

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/working-with-monetary-amounts).

The currency code must match the currency associated with the business
that is accepting the payment.
app_fee_allocationsarrayOptionalDetails pertaining to recipients of the application fee. The sum of the amounts in the
app_fee_allocations must equal the app_fee_money amount, if present. If populated, an
allocation must be present for every party that expects to receive a portion of the application
fee, including the application developer.
app_fee_allocations[]ModelEach itemExpand Create Payment — request body — body app fee allocations item
app_fee_moneyModelOptionalExpand 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/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/take-payments-and-collect-fees#permissions).
autocompletebooleanOptionalIf set to `true`, this payment will be completed when possible. If
set to `false`, this payment is held in an approved state until either
explicitly completed (captured) or canceled (voided). For more information, see
[Delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment).

Default: true
billing_addressModelOptionalExpand Create Customer — request body — body address
The buyer's billing address.
buyer_email_addressstringOptionalThe buyer's email address.
Maximum length: 255
buyer_phone_numberstringOptionalThe buyer's phone number.
Must follow the following format:
1. A leading + symbol (followed by a country code)
2. The phone number can contain spaces and the special characters `(` , `)` , `-` , and `.`.
Alphabetical characters aren't allowed.
3. The phone number must contain between 9 and 16 digits.
cash_detailsModelOptionalExpand Create Payment — request body — body cash details
Additional details required when recording a cash payment (`source_id` is CASH).
customer_detailsModelOptionalExpand Create Payment — request body — body customer details
Details about the customer making the payment.
customer_idstringOptionalThe [Customer](entity:Customer) ID of the customer associated with the payment.

This is required if the `source_id` refers to a card on file created using the Cards API.
delay_actionstringOptionalThe action to be applied to the payment when the `delay_duration` has elapsed. The action must be
CANCEL or COMPLETE. For more information, see
[Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).

Default: CANCEL
delay_durationstringOptionalThe duration of time after the payment's creation when Square automatically
either completes or cancels the payment depending on the `delay_action` field value.
For more information, see
[Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).

This parameter should be specified as a time duration, in RFC 3339 format.

Note: This feature is only supported for card payments. This parameter can only be set for a delayed
capture payment (`autocomplete=false`).

Default:

- Card-present payments: "PT36H" (36 hours) from the creation time.
- Card-not-present payments: "P7D" (7 days) from the creation time.
external_detailsModelOptionalExpand Create Payment — request body — body external details
Additional details required when recording an external payment (`source_id` is EXTERNAL).
idempotency_keystringRequired within parentA unique string that identifies this `CreatePayment` request. Keys can be any valid string
but must be unique for every `CreatePayment` request.

Note: The number of allowed characters might be less than the stated maximum, if multi-byte
characters are used.

For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
Maximum length: 45
Minimum length: 1
location_idstringOptionalThe location ID to associate with the payment. If not specified, the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location) is
used.
notestringOptionalAn optional note to be entered by the developer when creating a payment.
Maximum length: 500
offline_payment_detailsModelOptionalExpand Create Payment — request body — body offline payment details
An optional field for specifying the offline payment details. This is intended for
internal 1st-party callers only.
order_idstringOptionalAssociates a previously created order with this payment.
reference_idstringOptionalA user-defined ID to associate with the payment.

You can use this field to associate the payment to an entity in an external system
(for example, you might specify an order ID that is generated by a third-party shopping cart).
Maximum length: 40
shipping_addressModelOptionalExpand Create Customer — request body — body address
The buyer's shipping address.
source_idstringRequired within parentThe ID for the source of funds for this payment.
This could be a payment token generated by the Web Payments SDK for any of its
[supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods),
including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment
that the seller received outside of Square, specify either "CASH" or "EXTERNAL".
For more information, see
[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
Minimum length: 1
statement_description_identifierstringOptionalOptional additional payment information to include on the customer's card statement
as part of the statement description. This can be, for example, an invoice number, ticket number,
or short description that uniquely identifies the purchase.

Note that the `statement_description_identifier` might get truncated on the statement description
to fit the required information including the Square identifier (SQ *) and name of the
seller taking the payment.
Maximum length: 20
team_member_idstringOptionalAn optional [TeamMember](entity:TeamMember) ID to associate with
this payment.
tip_moneyModelOptionalExpand Create Payment — request body — body tip money
The amount designated as a tip, in addition to `amount_money`.

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/working-with-monetary-amounts).

Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.

The currency code must match the currency associated with the business
that is accepting the payment.
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.

For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview).

Referenced models: Create Customer — request body — body address, Create Payment — request body — body app fee allocations item, Create Payment — request body — body cash details, Create Payment — request body — body customer details, Create Payment — request body — body external details, Create Payment — request body — body tip money, Create Payment — request body — body offline payment details

Create Payment — response body
FieldTypePresenceDescription and constraints
$objectRootDefines the response returned by [CreatePayment](api-endpoint:Payments-CreatePayment).

If there are errors processing the request, the `payment` field might not be
present, or it might be present with a status of `FAILED`.
errorsarrayOptionalInformation about errors encountered during the request.
errors[]ModelEach itemExpand Get Shift — response body — errors item
paymentModelOptionalExpand Get Payment — response body — payment
The newly created payment.

Referenced models: Get Shift — response body — errors item, Get Payment — response body — payment

SDK function policy ID: square.createpayment. Catalog operation: CreatePayment. 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: ["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.