I need to run a very simple function when an order is set to complete and/or if the payment was successful.

If it's relevant we're using Global Transport for payment. I mention it mostly because where I expect to see an order status go from "pending" to "complete" (as per documentation) it seems to stay as "pending"... this is possibly a red herring.

I'm almost losing track of the things I've tried:

  • sales_order_invoice_save_after
  • sales_order_payment_pay
  • sales_order_place_after
  • sales_order_payment_place_end

To be clear: I only need to run this function when payment is received for an order. These seem to run, but when I try to capture the order/payment object it's always "pending".

up vote 3 down vote accepted

You have this observer:

checkout_onepage_controller_success_action

The observer return order_ids :

<?php
class Namespace_Modulename_Model_Observer
{
    public function customFunction(Varien_Event_Observer $observer)
    {
        $order = $observer->getData('order_ids');
         //here you can add your custom code

    }        

}
  • this is great. I was hung up on trying to look too closely and track payment itself, but of course this works. – user5482 May 7 '15 at 14:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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