We subscribe to the order.updated webhook event. Recently we noticed that while some of our customers were receiving updated order information others were not. Documentation reveals that the order.updated event is triggered by the UpdateOrder endpoint call. One of the requirements for this endpoint call is “the latest version of the order to update.” Based on this information we were able to identify that the order updates that we do receive all contain a version
property while the ones that we don’t receive contain no version
property in the Order JSON object. Following are extracts from both types of orders:
- Example 1 (Order for which we DO receive an order.updated event)
Merchant ID: MLHPTH16766N1
{
"id": "DVKLSsWwZ3mCPxm0ghxRmfDjwbfZY",
"locationId": "LF3FP289Q4929",
....
"createdAt": "2022-06-17T17:10:20.930Z",
"updatedAt": "2022-06-17T17:10:23.000Z",
"state": "OPEN",
"version": 4,
}
- Example 2 (Order for which we DO NOT receive an order.updated event)
Merchant ID: 7AY592R18CJFR
{
"id": "CasZpWO7rKuP0NE1xQGcVoleV",
"locationId": "DTEM7TYS447NH",
...
"createdAt": "2022-06-19T17:19:47.000Z",
"updatedAt": "2022-06-21T05:19:49.000Z",
"closedAt": "2022-06-21T05:19:49.000Z",
"state": "COMPLETED",
}
It seems that Example (1) uses a different order processing flow (or API version) compared to Example (2). How can we reliably know what order processing flow (or API version) the merchant is using? On our end, this will allow us to identify the order extraction method to use for any given merchant (either webhooks or manual polling).
Thanks!
The order that has the version was created by our APIs through an app that the seller is using and will trigger order webhook events. The second order was created and tendered by our Restaurants Point of Sale. Currently only Order API calls to the endpoints will trigger order webhook events. If you’d like to get events for the Restaurants app you’ll need to listen for payment webhook events.
@Bryan-Square Then instead of listening to order webhooks, we can just listen to payment.updated webhook as that will guarantee that a new order has been paid for? Irrespective of the order source - API, Restaurant POS or Terminal device?
You’ll want to make sure that you also listen to payment.created
events since some cash payments will only be created and never need to be updated.
@Bryan-Square The environment is as follows:
-
Retail Store:
a. 2 Square POS registers. The bulk of transactions are processed by these two registers.
b. 2 iPads running Square for Business apps. These do not process orders through payment.
-
Shipping:
a. 1 Square POS Terminal. Intermittent sales, generally not assigned to customers.
-
Bernina:
a. 1 iPad running Square for Business app. Not high volume, but some sales throughout the day.
-
The Gathering:
a. 1 Square POS register. The second most used register.
What is happening is that we are not getting order.updated webhook for few of the orders. Why is this happening? How do we make sure we get all order.updated events for all orders irrespective of their source? What’s the best way to go about this?
We just want to run a script in our CRM every time an order is placed and paid for irrespective of the source of the order or what device it was placed from.
So I guess:
- order.updated - to track paid orders from API.
- payment.updated & payment.created - to track orders paid from registers?
- Any other edge case?