# Updating the State of an order

**URL:** <https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107>\
**Category:** Questions\
**Tags:** orders-api\
**Created:** [April 4, 2023, 8:21pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107 "2023-04-04T20:21:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bri](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@Bri](https://developer.squareup.com/forums/u/Bri)\
**Post date:** [April 4, 2023, 8:21pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/1 "2023-04-04T20:21:40Z")

</div>

Hello, Please I am trying to update the state of an order in square but here is the error an getting…

 ![error](https://global.discourse-cdn.com/square/original/2X/b/b290d4052ac94739d8f3456ce09f0402436a4230.png)

Please I need a link to a documentation where I can get a guide to update an order state

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 4, 2023, 8:45pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/2 "2023-04-04T20:45:42Z")

</div>

What’s the `order_id`? Is the order paid for and what state are you trying to change it too? 🙂

---

<div class="post-metadata">

**Author:** ![Bri](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@Bri](https://developer.squareup.com/forums/u/Bri)\
**Post date:** [April 4, 2023, 9:12pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/3 "2023-04-04T21:12:36Z")

</div>

The order state is open… I want to change it to completed because the order has been paid for manual by the customer so I want to update it to completed…

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 4, 2023, 10:14pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/4 "2023-04-04T22:14:04Z")

</div>

Orders cannot be completed before payments have been processed for the order. Was the payment taken by Square? 🙂

---

<div class="post-metadata">

**Author:** ![Bri](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@Bri](https://developer.squareup.com/forums/u/Bri)\
**Post date:** [April 4, 2023, 10:30pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/5 "2023-04-04T22:30:02Z")

</div>

The payment was not taken by square, the payment was made manually through bank transfer to our account so we want to be able to mark the order as completed instead of the initial state of open

---

<div class="post-metadata">

**Author:** ![Bri](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@Bri](https://developer.squareup.com/forums/u/Bri)\
**Post date:** [April 4, 2023, 10:31pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/6 "2023-04-04T22:31:53Z")

</div>

$client = new SquareClient([  
‘accessToken’ =\> env(‘SQUARE\_ACCESS\_TOKEN2’),  
‘environment’ =\> $this-\>ENVIRONMENT,  
]);

$body = new UpdateOrderRequest();  
$body-\>setState(‘COMPLETED’);  
$ordersApi = $client-\>getOrdersApi();  
$apiResponse = $ordersApi-\>updateOrder($orderId, $body);

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 4, 2023, 10:34pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/7 "2023-04-04T22:34:59Z")

</div>

You can create an [EXTERNAL](https://developer.squareup.com/docs/payments-api/take-payments/external-payments) payment with the `order_id` and it will complete the order. No money will move, the payment will be accounted for in Square and the order will be paid for. 🙂

---

<div class="post-metadata">

**Author:** ![Bri](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@Bri](https://developer.squareup.com/forums/u/Bri)\
**Post date:** [April 4, 2023, 10:47pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/8 "2023-04-04T22:47:05Z")

</div>

What if in a case where I want to use 100% discount to cover for the payment, how to I go about it in order to ensure that the order is completed… Thanks for your kind responses

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 5, 2023, 12:07am UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/9 "2023-04-05T00:07:12Z")

</div>

Is the order going to be completed in the US? If so you can now create a $0 payment with the Payments API. If your processing in other regions you can use [PayOrder](https://developer.squareup.com/docs/orders-api/pay-for-orders) to pay for a $0 order. 🙂

---

<div class="post-metadata">

**Author:** ![Bri](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@Bri](https://developer.squareup.com/forums/u/Bri)\
**Post date:** [April 5, 2023, 12:32am UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/10 "2023-04-05T00:32:11Z")

</div>

Please can you share the api documentation on how to create a $0 dollar payment using the PaymentApi

---

<div class="post-metadata">

**Author:** ![onderboydak](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@onderboydak](https://developer.squareup.com/forums/u/onderboydak)\
**Post date:** [January 26, 2024, 2:31pm UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/11 "2024-01-26T14:31:46Z")

</div>

Hi ;

I am trying the following request for the update order state but giving the following error.  
Could you support me for this ?

Regards.

curl [https://connect.squareupsandbox.com/v2/orders/Vg2aBPcaxnpQdtSkD1fzYFBhj7TZY](https://connect.squareupsandbox.com/v2/orders/Vg2aBPcaxnpQdtSkD1fzYFBhj7TZY)   
-X PUT   
-H ‘Square-Version: 2024-01-18’   
-H ‘Authorization: Bearer \*\*\*\*\*\*’   
-H ‘Content-Type: application/json’   
-d ‘{  
“order”: {  
“location\_id”: “LPNNF5GSK68RD”,  
“version”: 15,  
“fulfillments”: [  
{  
“state”: “COMPLETED”,  
“uid”: “9d521c70-ea5d-24e7-8562-1496e0a165ed”  
}  
],  
“state”: “COMPLETED”  
}  
}’

Error

```auto
{
  "errors": [
    {
      "code": "INVALID_VALUE",
      "detail": "All fulfillments must have a state of COMPLETED, CANCELED, or FAILED for an order to be able to have a state of COMPLETED.",
      "field": "order.fulfillments[0]",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![josh-square](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@josh-square](https://developer.squareup.com/forums/u/josh-square)\
**Post date:** [January 27, 2024, 1:42am UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/12 "2024-01-27T01:42:56Z")

</div>

Hi @onderboydak, it looks like you may be specifying the wrong `uid` for the fulfillment you’re attempting to complete. The `uid` of the fulfillment on that order is `s3TJ8yiRgXArwUtKUqnhoB`.

---

<div class="post-metadata">

**Author:** ![onderboydak](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@onderboydak](https://developer.squareup.com/forums/u/onderboydak)\
**Post date:** [January 29, 2024, 9:51am UTC](https://developer.squareup.com/forums/t/updating-the-state-of-an-order/9107/13 "2024-01-29T09:51:55Z")

</div>

Hi

Thank you for reply.

This order is two lines. I think each line will be post.

Regards.
