Update order BETA
Updates an open order by adding, replacing, or deleting fields.
Orders with a COMPLETED
or CANCELED
state cannot be updated.
An UpdateOrder
request requires the following:
- The
order_id
in the endpoint path, identifying the order to update. - The latest
version
of the order to update. - The sparse order containing only the fields to update and the version to which the update is being applied.
- If deleting fields, the dot notation paths identifying the fields to clear.
To pay for an order, see Pay for Orders.
Name | Description |
---|---|
order_
Required
|
The ID of the order to update. |
Name | Description |
---|---|
order
|
The sparse order containing only the fields to update and the version to which the update is being applied. |
fields_
|
The dot notation paths
fields to clear. For example, |
idempotency_
|
A value you specify that uniquely identifies this update request. If you are unsure whether a particular update was applied to an order successfully, you can reattempt it with the same idempotency key without worrying about creating duplicate updates to the order. The latest order version is returned. For more information, see Idempotency. |
Response Fields
Name | Description |
---|---|
order
|
The updated order. |
errors
|
Any errors that occurred during the request. |
Examples
- cURL
- Ruby
- Python
- C#
- Java
- PHP
- Node.js
curl https://connect.squareup.com/v2/orders/DREk7wJcyXNHqULq8JJ2iPAsluJZY \
-X PUT \
-H 'Square-Version: 2023-01-19' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"idempotency_key": "UNIQUE_STRING",
"order": {
"version": 1,
"line_items": [
{
"uid": "cookie_uid",
"quantity": "2",
"name": "COOKIE",
"base_price_money": {
"amount": 200,
"currency": "USD"
}
}
]
},
"fields_to_clear": [
"discounts"
]
}'
{
"order": {
"version": 2,
"total_money": {
"currency": "USD",
"amount": 900
},
"source": {
"name": "Cookies"
},
"line_items": [
{
"total_tax_money": {
"currency": "USD",
"amount": 0
},
"total_money": {
"amount": 500,
"currency": "USD"
},
"gross_sales_money": {
"amount": 500,
"currency": "USD"
},
"base_price_money": {
"amount": 500,
"currency": "USD"
},
"quantity": "1",
"total_service_charge_money": {
"amount": 0,
"currency": "USD"
},
"total_discount_money": {
"currency": "USD",
"amount": 0
},
"name": "Small Coffee",
"uid": "EuYkakhmu3ksHIds5Hiot",
"variation_total_price_money": {
"amount": 500,
"currency": "USD"
}
},
{
"total_money": {
"amount": 400,
"currency": "USD"
},
"gross_sales_money": {
"currency": "USD",
"amount": 400
},
"total_tax_money": {
"currency": "USD",
"amount": 0
},
"variation_total_price_money": {
"currency": "USD",
"amount": 400
},
"name": "COOKIE",
"uid": "cookie_uid",
"base_price_money": {
"amount": 200,
"currency": "USD"
},
"quantity": "2",
"total_service_charge_money": {
"amount": 0,
"currency": "USD"
},
"total_discount_money": {
"amount": 0,
"currency": "USD"
}
}
],
"state": "OPEN",
"total_service_charge_money": {
"amount": 0,
"currency": "USD"
},
"id": "DREk7wJcyXNHqULq8JJ2iPAsluJZY",
"location_id": "MXVQSVNDGN3C8",
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"created_at": "2019-08-23T18:26:18.243Z",
"total_discount_money": {
"amount": 0,
"currency": "USD"
},
"net_amounts": {
"service_charge_money": {
"currency": "USD",
"amount": 0
},
"total_money": {
"amount": 900,
"currency": "USD"
},
"discount_money": {
"currency": "USD",
"amount": 0
},
"tax_money": {
"currency": "USD",
"amount": 0
}
},
"updated_at": "2019-08-23T18:33:47.523Z"
}
}