v1

latestOpenAPI 3.0.0Apache 2.02026-07-143281,4552.1 MB
OrderCustomAttributes

UpsertOrderCustomAttribute

Creates or updates a custom attribute for an order.

Use this endpoint to set the value of a custom attribute for a specific order. A custom attribute is based on a custom attribute definition in a Square seller account. (To create a custom attribute definition, use the CreateOrderCustomAttributeDefinition endpoint.)

To create or update a custom attribute owned by another application, the visibility setting must be VISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

post/v2/orders/{order_id}/custom-attributes/{custom_attribute_key}

Path parameters

order_idstring required

The ID of the target order.

custom_attribute_keystring required

The key of the custom attribute to create or update. This key must match the key of an existing custom attribute definition.

Request body

idempotency_keystring nullable

A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.

Example request

{
  "custom_attribute": {
    "key": "table-number",
    "value": "42",
    "version": 1
  }
}

Response

Success

Example response

{
  "custom_attribute": {
    "created_at": "2022-10-06T20:41:22.673Z",
    "key": "table-number",
    "updated_at": "2022-10-06T20:41:22.673Z",
    "value": "42",
    "version": 1,
    "visibility": "VISIBILITY_READ_WRITE_VALUES"
  }
}