Hi everyone,
How are supposed to create a partial refund programmatically in Magento 2?
The best answer I found for a full refund is this:
// Inject \Magento\Sales\Api\RefundInvoiceInterface $invoiceRefunder $invoiceRefunder->execute( 123, // Invoice ID (NOTE: not increment ID) [], // Items array (default all) true // Online refund--send to payment gateway );
This works perfectly for a full refund but how can we handle a partial refund?
I am looking for a solution that would use the amount of partial refund because I won't be able to provide the list of items to refund (the refund request comes from the gateway and the gateway provides only an amount to refund, not the list of items).
Thanks a lot for your answers.
kindly refer below blogs for the partial refund,
Hope you have helped this blog.
@Rakesh Jesadiya, thank you for this link, very instructive.
However you are suggesting a refund per item when the question I'm asking is:
is there a way to perform a partial refund from amount because I don't have the items to refund.
Basically I have to refund an amount sent from a remote payment gateway. The payment gateway sends an amount to refund but doesn't handle the items. So when the gateway refund request arrives to Magento, there are no items. I believe that most gateways don't work with items to refund, but amounts.