0

My Magento 2.2.6 website has an issue with invoice generation.

We use Paypal and Stripe as payment methods. Each one is configured on Authorize and Capture.

With orders payed with Paypal we don't have problems.

With the Stripe's ones, instead, we have a strange behavior. Sometimes, Magento creates 2 invoices. One that is correct and another with 0 € as amount. This is a problem because the progressive number of invoices is important for administrative reasons.

So I'm trying to figure out where the problem is.

Someone knows where in the code Magento 2 creates and save an invoice? I've found this file:

vendor/magento/module-sales/Model/InvoiceOrder.php

Is there other place where I need to fix the code?

In my idea, I want to avoid this duplication simply evaluating if the order has been yet invoiced or not... and the skipping the creation of the second invoice. It should be possible by checking something like:

if ($order->getInvoiceCollection()->count() == 0) {
            // go ahead and invoice this order
        }
else {return;}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.