I integrate my website with MIGS payment Gateway.

I have an issue on orders, if customer cancel the payment from payment gateway successfully return to website and show the order as cancelled but from the admin panel order status shows as processing.

How can i update order status as cancelled.

I tried this by magento event observer. But It is not working. Following are my coding.

File Wired_Orderscancel.xml(Path:-/app/etc/modules)

<?xml version="1.0" encoding="utf-8"?>

File config.xml(Path:-\app\code\local\Wired\Orderscancel\etc)

<?xml version="1.0"?>

File Observer.php (Path:-\app\code\local\Wired\Orderscancel\Model)

class Wired_Orders_Model_Observer extends Varien_Event_Observer
public function CodeOrdeStatus($observer){

    $order = $observer->getEvent()->getOrder();

    //$order->setData('state', "complete");


How can i fix this issue, Thank you

1 Answer 1



$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Cancel Transaction.');
  • thank you. how to track the order id? where do i want to add the code in my observer?
    – Mujahidh
    Apr 13, 2015 at 13:59

Your Answer

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

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