8

I'm running Magento 1.6.2.

I need to determine if an order is paid. If yes, I generate some XML data for export. There is many cases in the Magento order/payment/shipment workflow.

My first guess is when the attribute "state" of the order is defined as "processing", but I'm not sure because of the large amount of possibilities in this workflow. May be this case is not covering all the possibilities ...

Am I right with that ?

  • Check if there is an invoice generated for the order. – Marius Nov 21 '13 at 15:46
  • Just invoice ? No other stuff ? I'm surprised, it seems too easy to be real aha. Thank you for your help! – guillaume_shm Nov 21 '13 at 15:59
  • Usually the presence of an invoice means it's been paid. – Marius Nov 21 '13 at 16:00
  • That's not enough in all cases, as an invoice can be unpaid. And it's possible that an invoice doesn't cover all ordered items, so there may be more than one invoice. – Andreas von Studnitz Nov 21 '13 at 16:08
  • Checking the state may do depending on your workflow, but the state "processing" may also mean that the order is sent, but not paid yet. I wouldn't use that. – Andreas von Studnitz Nov 21 '13 at 16:25
22

You can call $order->getBaseTotalDue(). If this is 0, the order is fully paid.

  • Thank you Andreas, this answer seems to be the one who fit the most to my answer. – guillaume_shm Nov 22 '13 at 9:51
1

See Andreas answer on how to determine if there is anything left to pay. To answer your other question - using state == processing is not good enough. A quick test to show this is to ship an unpaid order - this will also move an order to the processing state even though the order is still unpaid.

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.