I have canceled the current order like
use Magento\Sales\Model\OrderFactory; $order = $this->orderFactory->create()->loadByIncrementId($order->getIncrementId()); $order->cancel()->save();
After that, create a new quote and assign the quote item using this link.
It's working fine. But when the ordered product has 1 qty, it returned the "product is out of stock" message.
How to resolve that.
How to restore the quote for payment failure.