I have a function which is creating an invoice, just the status of the invoice created is "pending". How can I create the invoice with the status "Complete"?

$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();

if (!$invoice->getTotalQty())
    Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));

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


CE 1.9

1 Answer 1


I solved with the following code


Your Answer

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

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