We're using Authorization, then Capture method for Credit Card payments. After we've quickly glanced over a batch of orders we'd like to invoice them all at once.

Step 1: Invoicing is easy. "Sales" -> "Orders". Click on the orders you'd like to invoice. Go to "Actions [Invoice]". "Submit". Multiple orders have just been invoiced!

Step 2 (Capturing) is the problem -- none of the invoices get Captured and the created invoices are given the status "Pending". From the "Sales"->"Invoices" lists, we can manually click into each Invoice, we can click the option "Capture" and that works . We can also go to "Sales" -> "Orders" and click "Invoice" and that will capture as well. But clicking into the orders manually kind of defeats the purpose of Step 1.

Is there some sort of Pending Invoice scheduler that captures pending CC invoices and I'm not aware of it??

2 Answers 2


Currently, this functionality doesn't exist but there are plugins that do it. However, if you're feeling fancy you can run some code that will capture all invoices from orders that are in a pending status:



$_helper = Mage::helper('core');

$orders = Mage::getModel('sales/order')

foreach($orders as $order){

    try {
            Mage::throwException($_helper->__('Cannot create an invoice.'));
        $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
        if (!$invoice->getTotalQty()){
            Mage::throwException($_helper->__('Cannot create an invoice without products.'));


        $transactionSave = Mage::getModel('core/resource_transaction')

    } catch (Mage_Core_Exception $e) {
        //do something meaningful here?


Source (invoice capture portion) Inchoo: http://inchoo.net/ecommerce/magento/how-to-create-magento-invoice-from-order/

  • Thanks for confirming Phil. I found plugins that you were talking about and the code that does it is really helpful. I also discovered one of a tools we're using for accounting integration ( Ecc Webgility ) does it really efficiently too. It's nice to have options.
    – JustinP
    Commented Jan 21, 2014 at 11:49

I was trying to capture a lot of orders at the same time with my own code, and kept getting this error no matter what I tried:


We were not able to find the order you are making this action for. Please make sure you are calling for the correct order and try again.


Turns out Magento wasn't quick enough, so I actually had to (yes this is true) add a 1 second timeout between iterations. My complete code as follows:


 * this method was part of a console script, that's why i echo stuff.
public function fixOrders()
    foreach ($this->orderArray as $incrementId) {
        try {
            /** @var Mage_Sales_Model_Order $orderModel */

            if ($orderModel->getIncrementId() == $incrementId) {
                /** @var Mage_Sales_Model_Order_Invoice $invoice */
                $invoice = $orderModel->getInvoiceCollection()->getFirstItem();
                if (!$invoice->canCapture()) {
                    throw new Exception("Could not capture invoice for order ".$incrementId);


                echo "Invoiced order ".$incrementId."\n";
            } else {
                throw new Exception("Failed to load order ".$incrementId);
        } catch (Exception $e) {
            echo "--- d'oh! Failed on: ".$incrementId." with msg -> ".$e->getMessage()."\n";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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