Problem/Motivation
We've run into the following issue several times now. Orders using PayPal checkout raise the following error:
Payment failed via PayPal Checkout for XX,XX € using PayPal.
Message: {"name":"UNPROCESSABLE_ENTITY","details":[{"issue":"ORDER_ALREADY_COMPLETED","description":"The order cannot be patched after it is completed."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"xxx","links":[{"href":"https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ORDER_ALREADY_COMPLETED","rel":"information_link","method":"GET"}]}.
Right before this, we see the following in the order log:
Order moved from Draft to Eingegangen by the Place order transition.
But after the PayPal Error the order (that is indeed already paid!) is in "Draft" state again!
That's a major issue, because nobody sees this paid order and the order is never processed and shipped, while paid. Clients are angry, giving bad ratings.
The nature of this issue looks like a race condition to me. Maybe the PayPal Webhook updates the order very fast, while the regular order completion is not yet finished? Or maybe something else?
Steps to reproduce
Set up PayPal Checkout and see this from time to time, while 95% of all orders with PayPal Checkout just run fine!
Proposed resolution
Remaining tasks
User interface changes
None
API changes
Data model changes