• Example searches: “transaction”, “CreateOrder”, “/v2/locations”, “inventory”, “delete customer”

You are viewing an old version of the API
Update order BETA

PUT /v2/orders/{order_id}

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 the update is being applied to.
  • If deleting fields, the dot notation paths identifying fields to clear.

To pay for an order, please refer to the Pay for Orders guide.

To learn more about the Orders API, see the Orders API Overview.


Permissions
ORDERS_WRITE
Try in API Explorer
Name Description
order_id
string

Required

The ID of the order to update.

Name Description
order
Order

The sparse order containing only the fields to update and the version the update is being applied to.

fields_to_clear
string [ ]

The dot notation paths fields to clear. For example, line_items[uid].note Read more about Deleting fields.

idempotency_key
string

A value you specify that uniquely identifies this update request

If you're 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 will be returned.

See Idempotency for more information.

Max Length 192

Response Fields

Name Description
order
Order

The updated Order.

errors
Error [ ]

Any errors that occurred during the request.

Examples

You are viewing an old version of the API
PUT /v2/orders/{order_id}
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
curl https://connect.squareup.com/v2/orders/DREk7wJcyXNHqULq8JJ2iPAsluJZY \
  -X PUT \
  -H 'Square-Version: 2020-08-26' \
  -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"
    ]
  }'
Response JSON
{
  "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_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_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"
  }
}

Share Feedback

Thanks for visiting the Square API documentation. What's on your mind?