Inconsistent behavior with orders.created webhook events

We are using the orders.created webhook to monitor for online purchases and then update our WMS and trigger fulfillment. Over the last week (since 8/21, to the best of my knowledge), we’ve seen inconsistent behavior in these events.

We monitor orders and interrogate the state tag of the payload. If the state tag is “OPEN”, we accept the order and process it. If the state is “DRAFT”, we do not, since the same order will be published on the webhook as DRAFT first and then shortly after as OPEN.

Over the last week, we’ve started seeing a large number of orders that only have an entry with the state as DRAFT. An order with state equal to OPEN is never received. In our own testing, we have confirmed this occurs despite payment completing successfully.

An example of a payload with state equal to OPEN:

{
“merchant_id”: “MLBF9DKQDN81Q”,
“type”: “order.created”,
“event_id”: “a707034f-e7bf-339f-a903-468e21e427f5”,
“created_at”: “2024-08-26T20:22:47Z”,
“data”: {
“type”: “order”,
“id”: “Q0TlbtnnJJ698XcQNHOdRC5MT5JZY”,
“object”: {
“order_created”: {
“created_at”: “2024-08-26T20:22:47.332Z”,
“location_id”: “LBV8H9VDT5CV0”,
“order_id”: “Q0TlbtnnJJ698XcQNHOdRC5MT5JZY”,
“state”: “OPEN”,
“version”: 1
}
}
}
}

An example of a payload with state equal to DRAFT:

{
“merchant_id”: “MLBF9DKQDN81Q”,
“type”: “order.created”,
“event_id”: “80bc6a94-72d3-3924-9dbc-e99ba6c3efb8”,
“created_at”: “2024-08-26T20:20:15Z”,
“data”: {
“type”: “order”,
“id”: “sSFuHsibHyr5zK0y6XngZeMeQ6EZY”,
“object”: {
“order_created”: {
“created_at”: “2024-08-26T20:20:14.827Z”,
“location_id”: “LBV8H9VDT5CV0”,
“order_id”: “sSFuHsibHyr5zK0y6XngZeMeQ6EZY”,
“state”: “DRAFT”,
“version”: 1
}
}
}
}

Is there some other event we should be monitoring instead of orders.created? Why do some orders where payment is completed never publish an event with the order state set to OPEN?

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

Additional Documentation

Use Webhooks to Integrate with a Payroll System
Orders API
Gift Card Webhooks

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.

I saw your earlier request in Discord and I’ve reached out to the team about this. I’m just waiting on the team on this. :slightly_smiling_face:

Awesome, thanks for the response

Hi Brian - Were you able to chase down any information about this? We’re still being impacted by this behavior.

According to the team this behavior has been in place for quite some time. Like for years. It’s not net new behavior of the webhook. :slightly_smiling_face: