Thursday, April 22, 2010

How to change invoice status in Admin panel

Problem: When creating Invoice directly from Order in admin the invoice automatically gets marked as Paid. how can it be created with the status 'Pending' and marked as paid later.

Possible solution:
In order to create a 'pending' invoice, the payment method you use for the order must allow you to.
For that you need to add in the payment method's model this member:
protected $_canCapture = true;
You can add it right under
protected $_code  = 'PAYMENT CODE HERE';
For example if you want to do this for Check/money order you need to add the line above in app/code/core/Mage/Payment/Model/Method/Checkmo.php

After this when you create an invoice you will have an option near the save button to set the invoice status. (see picture attached). To create a pending invoice select 'Not capture'.
If you want to mark it later as paid edit the invoice and between the buttons on to one called 'Capture' (see picture). Well you get the idea....


  1. Thank you so much for sharing this info. It was a real lifesaver.

  2. Hey. Great info. But can this be done without changing core stuff (so that you can still update)? Like overriding the model in /app/code/local?

  3. Hello Dakira. Yes you can. You can override the payment method model just like any other model (or block or helper) and add the line I suggested in your class.

  4. Can i also use it in magento 1.5?

  5. Should this also work for pre-existing invoices, or only invoices created as 'pending' after applying this override?

    1. Hello.
      It works only for invoices created after applying the update.


  6. You know, if real accountants had been consulted on purchase order processing by the geeks who wrote this sorry stuff, it would not be necessary to tweak it like this. Obviously, the programmers who wrote this do not have to deal with invoicing. Since when is an invoice 'paid' just because it was printed or emailed?? How is a store owner expected to know what is due if all invoices are marked 'paid'?? Another downside to Magento....

    1. Yeah... I even put in a suggestion about changing this.
      Of course, their canned response was "the invoice is a receipt."
      ?!?!? WTF ?!?!?
      They obviously have not looked up the definition of invoice. LOL

  7. how can i do this programetically ? that is create invoice with pending staus.

    1. I didn't try this before, but you can try to simulate how the invoice is created in the controller. Add some debug lines in the 'Mage_Adminhtml_Sales_Order_InvoiceController::saveAction' method, see what data is sent by POST and how the invoice is created and do the same in your custom code.

  8. Yes i try this. and i think its work fine in fresh magento.

    I am using extension for one page checkout and because of this its not work for me.

    but i have update "protected $_canCapture = false; to "protected $_canCapture = true;" on /var/www/surpriseforu/public_html/app/code/core/Mage/Payment/Model/Method/Abstract.php path. and its work fine for me..

    Rakesh Patel.