2

I am using magento soap api v2, and using a payment gateway service. when creating an order, the confirmation email is sent even before processing the payment. How can i send email only when the payment is successful? I checked the source code of my local magento installation and found out this

in /app/code/core/Mage/Checkout/Controllers/OnepageController.php

$this->getOnepage()->saveOrder();
$redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();  
/*** a flag to set that there will be redirect to third party after confirmation
* eg: paypal standard ipn
*/
        $redirectUrl = this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
/**
* we only want to send to customer about new order when there is no redirect to third party
*/
        if (!$redirectUrl && $order->getCanSendNewEmailFlag()) {
            try {
                $order->sendNewOrderEmail();
            } catch (Exception $e) {
                Mage::logException($e);
            }
        }

But how can i do this from an external api. I cannot use a custom api also. Is this achievable using soap api. I set payment method using this link http://www.magentocommerce.com/api/soap/checkout/cartPayment/cart_payment.method.html

Anyone having similar situation

Ajith
  • 21
  • 2

0 Answers0