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.
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["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 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.orders.create_order(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 Order — request body — body |
Referenced models: Create Order — 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 Order — response body |
Referenced models: Create Order — response body
Schemas
Section titled “Schemas”88 more schemas are linked from the tables above, on the schema pages.
Create Order — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
idempotency_key | string | Optional | A 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 |
order | Model | Optional | Expand 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
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Defines 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. |
errors | array | Optional | Any errors that occurred during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
order | Model | Optional | Expand 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
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents 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. |
category | string | Required within parent | Indicates 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 |
code | Model | Required within parent | Expand Get Shift — response body — errors item code The specific code of the error. See [ErrorCode](#type-errorcode) for possible values |
detail | string | Optional | A human-readable description of the error for debugging purposes. |
field | string | Optional | The 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
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Contains 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_details | JSON | Optional | |
delivery_details (anyOf 1) | Model | Alternative | Expand 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) | null | Alternative | |
entries | array | Optional | A 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[] | Model | Each item | Expand Pay Order — response body — order fulfillments Details about order fulfillment item entries item |
in_store_details | JSON | Optional | |
in_store_details (anyOf 1) | Model | Alternative | Expand 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) | null | Alternative | |
line_item_application | string | Optional | The `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 |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | Application-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).* | string | Additional keys | |
metadata (anyOf 2) | null | Alternative | |
pickup_details | JSON | Optional | |
pickup_details (anyOf 1) | Model | Alternative | Expand 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) | null | Alternative | |
shipment_details | JSON | Optional | |
shipment_details (anyOf 1) | Model | Alternative | Expand 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) | null | Alternative | |
state | JSON | Optional | |
state (anyOf 1) | string | Alternative | The 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) | null | Alternative | |
type | JSON | Optional | |
type (anyOf 1) | string | Alternative | The 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) | null | Alternative | |
uid | JSON | Optional | |
uid (anyOf 1) | string | Alternative | A unique ID that identifies the fulfillment only within this order. Maximum length: 60 |
uid (anyOf 2) | null | Alternative |
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
Policy, approvals and errors
Section titled “Policy, approvals and errors”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"}