I am getting this error while online refunding credit memo using a script.
"Unable to create credit memo for order" error appear, this is due to this https://github.com/pepe1518/magento2/blob/89adbabc2a295c9b6f88768d541fd2858f59aae5/vendor/magento/module-sales/Model/Order.php#L603
I want to know in which conditions, this error come ?
ifsto check. So You have like 5 or 6 possibilities.. Check Order status. Is it mached to any requirement in one ofif? What about TotalPaid and Refunded? If You can use xdebug, just check manually allifsand compare to current state of order. YOu can also check MagentoDev for Credit Memo docs.magento.com/user-guide/v2.3/sales/credit-memo-create.html