Hello,
I am trying to understand how to cancel an order.
These are the steps I do:
1- Create an order with a pickup fulfilment. (set auto_complete_duration)
2- Create a payment for the order
3- Call update order- set the state of the fulfillment to RESERVED.
4- If nothing else is done- the order gets autocompleted - state = COMPLETE.
Say between 3 and 4, I want to now cancel the order.
If i call update order with order STATE = CANCELLED, i get an error
“code”: “BAD_REQUEST”,
“detail”: “Orders cannot be canceled after payments have been processed.”,
“field”: “order.state”,
If i issue a refund on the payment created at 2, the refund gets created successfully.
But i still can’t cancel the order, i get the same error message.
If i cancel the order via the square sandbox UI, i can do it- successfully.
My question is - what is the way to cancel an order - with or without refunds, via the API.
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:
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.
To follow up on this-
If I update the order with the fulfillment state to CANCELLED - the order remains in the OPEN state.
If i then try to change the state of. the order to CANCELLED via the updateOrder- it still fails with the same error
“detail”: “Orders cannot be canceled after payments have been processed.”,
However, on the square sandbox UI dashboard/orders/overview- i see the order state column mentions CANCELLED (although the retrieve order API call still says the order state is OPEN.
Also, when i filter by orders on the UI- this order shows up in the “Upcoming” filter, and not in the cancelled filter.
At this time canceling an order that has a payment isn’t currently available. The way Square cancels an order that’s paid for is we complete the order and refund the payment.
In that case- would it make sense to cancel the fulfillment only? So the square user can see the order as cancelled on the dashboard?
We sometimes have orders that don’t have refunds or only a partial refund. How should we proceed in that case?
How does it work via the square dashboard when you click on cancel? The payment is refunded, but the order state also moves to Cancelled.
If I refund the payment via the api- the original order state doesn’t change.