In Magento 2, in case the shopper cancels the payment, presses the back button or closes the browser window, no items are removed from the cart it is locked when the payment is being processed. This is done to avoid malicious attacks, like a person adding more items to a cart while the payment is being processed.
A locked cart is inaccessible, so when you access the e-commerce with a locked cart it looks like you lost all your items.
Afterwards there are two scenarios that provide a bad experience:
- The shopper presses the previous button on any of the payment pages (not the browser back button). This will result in a cancelled resultCode sent back to Magento. Magento will cancel the order, the items of the order will be put into a new basket, and the shopper will see these and can go to the checkout again without putting the items in the basket again.
- The shopper presses the back button in the browser, closes the browser window, or goes back to Magento without sending anything. This will result in Magento being unaware of the fact that the order is cancelled, and thus the order is still locked, along with the items.
In this second scenario, if the shopper ends up in Magento, he will see a new empty cart, because the previous one is still locked, so they need to put the items in the basket again. The locked order will be cancelled only after an OFFER_CLOSED notification reaches Magento 2, or if the merchant cancels it manually on the database. The basket won't be reset when this notification is processed.