public function checkoutOnepageControllerSuccessAction($observer) { // sales_order_invoice_pay($observer){ $orderId = $observer->getEvent()->getOrderIds(); $order = Mage::getSingleton('sales/order')->load($orderId[0]); $gcDiscount = $order->getGiftcardDiscount(); $gcCode = $order->getGiftcardCode(); if ($gcDiscount > 0) { $apiUrl = "https://ps1.merchantware.net/Merchantware/ws/ExtensionServices/v4/Giftcard.asmx?WSDL"; $merchName = $this->getConfigData("name"); $siteId = $this->getConfigData("site_id"); $key = $this->getConfigData("key"); // Create our soap client $client = new SoapClient($apiUrl, array("trace" => 1)); // Here is the data required to make this API call $card = array("merchantName" => $merchName, "merchantSiteId" => $siteId, "merchantKey" => $key, "cardNumber" => $gcCode, "amount" => $gcDiscount); // Make the API call $result = $client->SaleKeyed($card); } Mage::getSingleton('core/session')->unsGiftcardAmount(); Mage::getSingleton('core/session')->unsGiftcardCode(); return $this; }