I followed this to create an invoice for an order and it worked. But the created newly invoice is marked as paid. Can I created it as unpaid?

$invoice = $order->prepareInvoice();
$invoice->sendEmail(true, '');
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);

You can use the sales/order_invoice_api to create an invoice for your order. Depending on the settings of the payment method the invoice will be marked as Paid or Pending.

if the payment method has specified:

protected $_canCapture                  = true;
protected $_canCapturePartial           = true;

it is possible to create an invoice that has the state 'Pending' with the following code:

$emailInvoice = true;
$captureInvoice = false;

$invoiceApi = Mage::getModel('sales/order_invoice_api');
$invoiceId = $invoiceApi->create(
    Mage::helper('sales')->__('Invoice created!'),

if ($captureInvoice) {
| improve this answer | |

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.