# Update Order created via Payment Link

**URL:** <https://developer.squareup.com/forums/t/update-order-created-via-payment-link/13601>\
**Category:** Questions\
**Tags:** orders-api, payments-api\
**Created:** [March 15, 2024, 9:31pm UTC](https://developer.squareup.com/forums/t/update-order-created-via-payment-link/13601 "2024-03-15T21:31:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brygidDev](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@brygidDev](https://developer.squareup.com/forums/u/brygidDev)\
**Post date:** [March 15, 2024, 9:31pm UTC](https://developer.squareup.com/forums/t/update-order-created-via-payment-link/13601/1 "2024-03-15T21:31:50Z")

</div>

We are using “Payment Link” to send order information to Square and collect payment from customer. Is there any way to update the order created using the “Payment Link”?

> **[Update Orders](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)**
>
> Learn how to update orders and how to specify sparse objects in an update request to add, update, and delete fields.

As the update order documentation states that the orders created via Orders API can only be updated.

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [March 15, 2024, 9:31pm UTC](https://developer.squareup.com/forums/t/update-order-created-via-payment-link/13601/2 "2024-03-15T21:31:59Z")

</div>

👋 I’m Square Dev AI, here to help answer your question!  
Based on the information you’ve provided, the following documentation will help answer your question:

> **[Manage Checkout](https://developer.squareup.com/docs/checkout-api/manage-checkout)**
>
> Learn how to manage checkout links. The Checkout API provides endpoints to manage the checkout pages you created.

[https://developer.squareup.com/docs/orders-api/pay-for-orders](https://developer.squareup.com/docs/orders-api/pay-for-orders)

> **Additional Documentation**
>
> [Orders API Overview](https://developer.squareup.com/docs/orders-api/what-it-does)  
> [Update Orders](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders)  
> [Square Order Checkout](https://developer.squareup.com/docs/checkout-api/square-order-checkout)

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.  
Otherwise one of our Developer Advocates will provide additional assistance shortly.

---

<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:** [March 15, 2024, 9:38pm UTC](https://developer.squareup.com/forums/t/update-order-created-via-payment-link/13601/3 "2024-03-15T21:38:25Z")

</div>

Yes, you can update an order associated to a payment link. You’ll use [UpdateOrder](https://developer.squareup.com/reference/square/orders-api/update-order) to update the order created from the Checkout API. 🙂

---

<div class="post-metadata">

**Author:** ![brygidDev](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@brygidDev](https://developer.squareup.com/forums/u/brygidDev)\
**Post date:** [March 15, 2024, 10:26pm UTC](https://developer.squareup.com/forums/t/update-order-created-via-payment-link/13601/4 "2024-03-15T22:26:37Z")

</div>

Hi @Bryan-Square

I have few question related to Update Order if you can please read below and answer that would be really appreciated:

Update Order requires ‘ **version** ’ as when I don’t send it, it returns the following error:

```auto
{
  "errors": [
    {
      "code": "BAD_REQUEST",
      "detail": "Missing required parameter.",
      "field": "order.version",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}

```

**How to get find the ‘version’ of an order created using Payment Link?**

Also, when i randomly put version ‘1’ then I receive the following error back and I get the version number from the error details.

```auto
{
  "errors": [
    {
      "code": "VERSION_MISMATCH",
      "detail": "Supplied version 1 does not match the current version 7 of order AzlCrafSsgqjLxOJDfhGiqLOEyPZY.",
      "field": "order.version",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}

```

**After using the correct version, I just want to update the order _pickup\_at_ time and notes. Sent the following request:**

```auto
{
    "order": {
      "location_id": "LH891R7KHMSRQ",
      "fulfillments": [
        {
          "pickup_details": {
            "pickup_at": "2024-04-15T21:56:19.378Z",
            "note": "DOORDASH driver will come to pickup."
          }
        }
      ],
      "version": 7
    },
    "idempotency_key": "c101f037-7915-4962-b85b-b3c31b41421a"
  }

```

**Returns the following error:**

```auto
{
  "errors": [
    {
      "code": "ARRAY_LENGTH_TOO_LONG",
      "detail": "Orders cannot be created with more than one fulfillment.",
      "field": "order.fulfillments",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}

```

**Can you please tell me how to update an order with a new pickup\_at time?**

---

<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:** [March 15, 2024, 11:11pm UTC](https://developer.squareup.com/forums/t/update-order-created-via-payment-link/13601/5 "2024-03-15T23:11:25Z")

</div>

When a payment link is created an order is also created. That order is in the `CreatePaymentLink` response. When you need to update an order you’ll want to call `RetrieveOrder` with the `order_id` to get the latest version of the order.

As for your second error you’ll need to update the existing fulfillment that’s in the order. For example:

```auto
{
    "order": {
        "version": 1,
        "fulfillments": [
            {
                "uid": "{{my_fulfillments_uid}}",
                "state": "CANCELED"
            }
        ]
    }
}

```

🙂
