Search Orders-API Returns Two Versions of Same Record

We’re using API Explorer for a simple Orders API request to return orders created for PICKUP between two dates. Before the upgrade to API Version 2024-03-20, this seemed to work fine. Now what’s returned appears to be two versions of the same record (ie Version 7 and 6). See sample output below. Did something change in the API or am I doing something wrong and don’t understand the expected output? I blanked out the Location id in the output for security purposes.

{
“order_id”: “CisMc0hI3PTcDGVclZFmMzGPJzfZY”,
“version”: 6,
“location_id”: “XXXXXXXXXXXXX”,
“source”: “Square Online”,
“created_at”: “2024-03-21T23:10:53.712Z”,
“updated_at”: “2024-03-22T22:15:17.123Z”,
“closed_at”: “2024-03-22T22:15:17.123Z”,
“fulfillments”: [
{
“recipient”: “Mary Breese”,
“due_at”: “2024-03-22T21:45:00Z”
}
],
“line_items”: [
{
“name”: “Baked Fish Dinner”,
“quantity”: “1”
},
{
“name”: “Baked Fish Dinner”,
“quantity”: “1”
}
]
},
{
“order_id”: “K43bdRvEcQxfv1xsifm8eWmPPXcZY”,
“version”: 7,
“location_id”: “XXXXXXXXXXXXX”,
“source”: “Square Online”,
“created_at”: “2024-03-21T23:09:35.905Z”,
“updated_at”: “2024-03-21T23:10:40.304Z”,
“fulfillments”: [
{
“recipient”: “Mary Breese”,
“due_at”: “2024-03-22T21:45:00Z”
}
],
“line_items”: [
{
“name”: “Baked Fish Dinner”,
“quantity”: “1”
},
{
“name”: “Baked Fish Dinner”,
“quantity”: “1”
}
]
}

:wave: 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:

https://developer.squareup.com/docs/orders-api/manage-orders/search-orders

Additional Documentation

https://developer.squareup.com/docs/orders-api/what-it-does
https://developer.squareup.com/docs/orders-api/manage-orders/retrieve-orders
https://developer.squareup.com/docs/orders-api/order-returns-exchanges

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.

Read through all the supported documentation. It still doesn’t describe what I’m seeing. Notice there is a Version in each of the return records. What does the Version mean for each record returned?

I’m not sure I fully understand the question. The version for the order you provided is 6 which is the latest version of the order. Would you mind further clarifying the question? :slightly_smiling_face:

If you look at the previously attached returned JSON example, both a Version 6 and Version 7 of the record is returned. Same occurs for every record. Two versions are being returned for every record.

Those are two different orders. Orders can have different version based on the number of times the order is updated. It’s not uncommon to see orders with different versions. :slightly_smiling_face:

Ok. After doing a bit more research and using API Explorer, I think I see what’s happening. When an online order is first placed thei Fulfillment Status is ‘Reserved’. When the order is completed the Fulfillment Status changes to ‘Complete’. We have to specifically choose what Fulfillment Status we want to filter on. If left blank, both the records are returned, ie ‘Reserved’ and ‘Complete’. I suspect that solves the issue. From now on, we need to further clarify the query of what we want, otherwise both the ‘Reserved’ and ‘Complete’ records are returned.

Glad everything is cleared up. :slightly_smiling_face: