I need to stop Magento (version from generating invoices automatically with credit card or paypal payment methods.

I look at registerCaptureNotification() in app/code/Mage/Sales/Model/Order/Payment.php. If I comment out the following code snippet:

if (!$invoice) {
        if ($this->_isCaptureFinal($amount)) {
            // comment out the following to stop creating invoices automatically
            //$invoice = $order->prepareInvoice()->register();
        } else {
            if (!$skipFraudDetection) {
            $this->_updateTotals(array('base_amount_paid_online' => $amount));

But this doesn't seem to work. Invoices are still being generated using credit card payment.

What is the right way to prevent auto invoice generation?


Karl,goto app/code/core/Mage/Paypal/Model/Ipn.php
copy to


here magento create invoice on paypal order

find the code:

app/code/core/Mage/Paypal/Model/Ipn.php goto function

here create invoice by below code:

if ($invoice = $payment->getCreatedInvoice()) {
            $message = Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId());
            $comment = $order->sendNewOrderEmail()->addStatusHistoryComment($message)

just change it to


here function $payment->getCreatedInvoice() create invoice of an order

or used the extension:


  • thanks... but that extension doesn't work with Magento and it doesn't work with Credit Card (WorldPay).
    – Saul Karl
    Sep 1 '14 at 7:46
  • every payment gate have different different logic.. their magento extension have customization according to there logic. so, it not possible to define ,there we stop to create invoice.
    – Amit Bera
    Sep 1 '14 at 7:50
  • I had some other problem on similar lines, but taking cue from this answer I could solve it. Thank you. Upvoted
    – Aakash
    Aug 26 '17 at 3:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.