Magento Forum

Redirecting to a third party payment page
 
Gabriel Queiroz
Sr. Member
 
Total Posts:  135
Joined:  2008-05-28
Brasília, Brazil
 

Hello you all,

I’m creating a new version for an existing webshop. I have, fortunatelly, found magento, and i’m using it for the new version. For this initial version, we will keep using the old payment system, so, i’ll be using everything from magento, except for the payment method.

We want, temporarily, to use a third party payment method which was used in the old store page (short deadline issues). So, all I need is, when the user gets to the checkout page, to redirect him to this third party page. I have to transfer the amount and currency to a page located in other server. It will be made via a simple post. Then, this new page will take care of all the rest (validating credit card number, creating the transaction, etc...).

I’ve been digging through the code and found this method on the Mage_Checkout_OnepageController class:

public function saveOrderAction()
    
{
        $this
->_expireAjax();

        try 
{
            
if ($data $this->getRequest()->getPost('payment'false)) {
                $this
->getOnepage()->getQuote()->getPayment()->importData($data);
            
}
            $this
->getOnepage()->saveOrder();
            
$redirectUrl $this->getOnepage()->getCheckout()->getRedirectUrl();
            
$result['success'true;
            
$result['error']   false;
        
}
        
catch (Mage_Core_Exception $e{
            Mage
::logException($e);
            
$result['success'false;
            
$result['error'true;
            
$result['error_messages'$e->getMessage();
        
}
        
catch (Exception $e{
            Mage
::logException($e);
            
$result['success']  false;
            
$result['error']    true;
            
$result['error_messages'$this->__('There was an error processing your order. Please contact us or try again later.');
        
}

        
/**
         * when there is redirect to third party, we don't want to save order yet.
         * we will save the order in return action.
         */
        
if (isset($redirectUrl)) {
            $result[
'redirect'$redirectUrl;
        
}

        $this
->getResponse()->setBody(Zend_Json::encode($result));
    
}

In the end of the method i see the redirection, but, after hours trying to understand the code, i still didn’t get how to redirect the user.

Is there any way to do what i want and keep the code sane?

Thanks a lot!

 
Magento Community Magento Community
Magento Community
Magento Community
 
stereotomy
Jr. Member
 
Total Posts:  28
Joined:  2008-02-10
 

i think I have a similar issue.

my payment gateway requires only POSTing of billing and CC details. strictly no curl.

i’ve struggled many days, tried many things, so at the end I tried to modfy the eway shared code which works with redirection, but this time i couldnt capture the credit card details of the customer! strangely, only $billing-> methods work under classes that extend Mage_Payment_Model_Method_Abstract. $payment->getCcDetails dont work.

long story short, with the eway shared module, I could only capture billing details and store configuration which is pretty useless w/o the payment details.

dont think I am lazy, i read all the guides again and again, almost memorized all relevant topics, posted questions several times however still no luck.  if you can figure out how to do it, please let me know too.

so, at the end, feeling hopeless, I decided to get the CC details in the billing section of the checkout.

not so pretty but what am I to do except for crossing fingers?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top