Prevent Magento to empty cart after failed payments on magento 2

Hoping someone can help me.

When a customer cancels their order. The cart empties the basket. I can see solution for code injection for MAGE magento 1 to save the cart but nothing for magento 2.

Can you help or guide me with a magento 2 solution? Thanks in advance, Samantha