Skip to content

Square: Create Order

Square orders.createOrder: arguments, response, policy and SDK examples.

← Orders operations · Get started

Operation square.createorder

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

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

Referenced models: Create Order — response body

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

Create Order — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
idempotency_keystringOptionalA value you specify that uniquely identifies this
order among orders you have created.

If you are unsure whether a particular order was created successfully,
you can try it again with the same idempotency key without
worrying about creating duplicate orders.

For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
Maximum length: 192
orderModelOptionalExpand Create Order — request body — body order
The order to create. If this field is set, the only other top-level field that can be
set is the `idempotency_key`.

Referenced models: Create Order — request body — body order

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

Either `errors` or `order` is present in a given response, but never both.
errorsarrayOptionalAny errors that occurred during the request.
errors[]ModelEach itemExpand Get Shift — response body — errors item
orderModelOptionalExpand Pay Order — response body — order
The newly created order.

Referenced models: Get Shift — response body — errors item, Pay Order — response body — order

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 Order — request body — body order fulfillments Details about order fulfillment item
FieldTypePresenceDescription and constraints
$objectRootContains details about how to fulfill this order.
Orders can only be created with at most one fulfillment using the API.
However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online.
delivery_detailsJSONOptional
delivery_details (anyOf 1)ModelAlternativeExpand Create Order — request body — body order fulfillments Details about order fulfillment item delivery details Describes delivery details of an order fulfillment
Describes delivery details of an order fulfillment.
delivery_details (anyOf 2)nullAlternative
entriesarrayOptionalA list of entries pertaining to the fulfillment of an order. Each entry must reference
a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to
fulfill.

Multiple entries can reference the same line item `uid`, as long as the total quantity among
all fulfillment entries referencing a single line item does not exceed the quantity of the
order's line item itself.

An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`,
`CANCELED`, or `FAILED`. Fulfillments can be created and completed independently
before order completion.
Read only: true
entries[]ModelEach itemExpand Pay Order — response body — order fulfillments Details about order fulfillment item entries item
in_store_detailsJSONOptional
in_store_details (anyOf 1)ModelAlternativeExpand Create Order — request body — body order fulfillments Details about order fulfillment item in store details canceled at, completed at, in progress at, note, placed at, prepared at, recipient
Contains details for an in-store fulfillment. These details are required when the fulfillment
type is `IN_STORE`.
in_store_details (anyOf 2)nullAlternative
line_item_applicationstringOptionalThe `line_item_application` describes what order line items this fulfillment applies
to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries.
Describes what order line items this fulfillment applies to.
It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries.
See [FulfillmentFulfillmentLineItemApplication](#type-fulfillmentfulfillmentlineitemapplication) for possible values
One of: ALL, ENTRY_LIST
Read only: true
metadataJSONOptional
metadata (anyOf 1)objectAlternativeApplication-defined data attached to this fulfillment. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
Additional keys: see wildcard field
metadata (anyOf 1).*stringAdditional keys
metadata (anyOf 2)nullAlternative
pickup_detailsJSONOptional
pickup_details (anyOf 1)ModelAlternativeExpand Create Order — request body — body order fulfillments Details about order fulfillment item pickup details accepted at, auto complete duration, cancel reason, canceled at, curbside pickup details, expired at, expires at, is curbside pickup, note, picked up at, pickup at, pickup window duration, placed at, prep time duration, ready at, recipient, rejected at, schedule type
Contains details for a pickup fulfillment. These details are required when the fulfillment
type is `PICKUP`.
pickup_details (anyOf 2)nullAlternative
shipment_detailsJSONOptional
shipment_details (anyOf 1)ModelAlternativeExpand Create Order — request body — body order fulfillments Details about order fulfillment item shipment details cancel reason, canceled at, carrier, expected shipped at, failed at, failure reason, in progress at, packaged at, placed at, recipient, shipped at, shipping note, shipping type, tracking number, tracking url
Contains details for a shipment fulfillment. These details are required when the fulfillment type
is `SHIPMENT`.

A shipment fulfillment's relationship to fulfillment `state`:
`PROPOSED`: A shipment is requested.
`RESERVED`: Fulfillment in progress. Shipment processing.
`PREPARED`: Shipment packaged. Shipping label created.
`COMPLETED`: Package has been shipped.
`CANCELED`: Shipment has been canceled.
`FAILED`: Shipment has failed.
shipment_details (anyOf 2)nullAlternative
stateJSONOptional
state (anyOf 1)stringAlternativeThe current state of this fulfillment.
The state of the fulfillment.
See [FulfillmentState](#type-fulfillmentstate) for possible values
One of: PROPOSED, RESERVED, PREPARED, COMPLETED, CANCELED, FAILED
state (anyOf 2)nullAlternative
typeJSONOptional
type (anyOf 1)stringAlternativeThe type of fulfillment.
The type of the fulfillment.
See [FulfillmentType](#type-fulfillmenttype) for possible values
One of: PICKUP, SHIPMENT, DELIVERY, IN_STORE
type (anyOf 2)nullAlternative
uidJSONOptional
uid (anyOf 1)stringAlternativeA unique ID that identifies the fulfillment only within this order.
Maximum length: 60
uid (anyOf 2)nullAlternative

Referenced models: Create Order — request body — body order fulfillments Details about order fulfillment item delivery details Describes delivery details of an order fulfillment, Pay Order — response body — order fulfillments Details about order fulfillment item entries item, Create Order — request body — body order fulfillments Details about order fulfillment item in store details canceled at, completed at, in progress at, note, placed at, prepared at, recipient, Create Order — request body — body order fulfillments Details about order fulfillment item pickup details accepted at, auto complete duration, cancel reason, canceled at, curbside pickup details, expired at, expires at, is curbside pickup, note, picked up at, pickup at, pickup window duration, placed at, prep time duration, ready at, recipient, rejected at, schedule type, Create Order — request body — body order fulfillments Details about order fulfillment item shipment details cancel reason, canceled at, carrier, expected shipped at, failed at, failure reason, in progress at, packaged at, placed at, recipient, shipped at, shipping note, shipping type, tracking number, tracking url

SDK function policy ID: square.createorder. Catalog operation: CreateOrder. 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"]

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.