1

I have stackoverflowed, googled etc but couldn't find the answer. I want to understand the logic behind the bank transfer payment method and invoice.

When we create invoices for orders that have payment method as Bank Transfer, invoice goes to PAID status by default.

Problem

In most cases, customer has yet not made full payment but have to send them invoice to ask for payment, which is why it must not marked as PAID in my case.

The function $this->canCapture() returning false for bank transfer orders.

Question

I would like to know how invoices are handled for bank transfer payment and is there a way to create invoice without marking it as PAID?

0

The status on the invoice is set in the method Mage_Sales_Model_Order_Invoice::pay() :

$invoiceState = self::STATE_PAID;
if ($this->getOrder()->getPayment()->hasForcedState()) {
   $invoiceState = $this->getOrder()->getPayment()->getForcedState();
}

So by default is set to paid if there is no "forced state" on the payment method.

you can use the event sales_order_invoice_pay dispatched in the same method to check if payment was done via bank transfer and set a different state to your invoice.

  • Will it also keep due amount? I will need to set status to paid and due 0 after creating invoice. – Adarsh Khatri Feb 17 '16 at 7:42
  • I don't know. You can try it and see what happens – Marius Feb 17 '16 at 8:41
  • I tried from observer as you suggested and can confirm observer method is called, but still invoice status is not changed, still it's PAID. I had done $invoiceState = 1;//self::STATE_OPEN; – Adarsh Khatri Feb 18 '16 at 0:11
  • but maybe the state is changed later by the line $invoiceState = $this->getOrder()->getPayment()->getForcedState(); – Marius Feb 18 '16 at 7:24

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.