Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Implementing redirect in payment module
 
sicruise
Jr. Member
 
Total Posts:  7
Joined:  2008-11-28
 

I am creating a module for a payment gateway that I am connecting into and I have a few questions.

I have had a look at the howto and it recommends to check out authorize.net example which is a direct connect method and it doesn’t really help me at the moment.

The payment gateway is hosting a payment page for me so I need to just need to store a few details like terminalid / currency etc

Using these I need to redirect the user to the hosted payment page.

I also need to know what page to tell the gateway to return to, is there a standard response page that you can add a method to to verify the response or can I create one from scratch and just point the whole url to this i.e. mysite.com/magento/app/code/community/mymodule/modulename/Model/response.php

Also is all the files I need to create contained within the Block / etc / Model / sql folders?

Basically I need a point in the right direction… any help would be greatly appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sicruise
Jr. Member
 
Total Posts:  7
Joined:  2008-11-28
 

I have had a bit more of a look into this and I believe for the response I can use a controller…

Do I have to register this Controller somewhere of will magento automatically look for it in the controller directory of my module?

I’m still confused how to implement a redirect, is the best thing to create a page with a button on it to initiate this redirect?

I’d prefer not to put in any unnecessary extra steps though…

 
Magento Community Magento Community
Magento Community
Magento Community
 
sicruise
Jr. Member
 
Total Posts:  7
Joined:  2008-11-28
 

Can somebody please help me with this… I’m stuck at the moment. I just need someone to get me started.

When I follow the tutorial at http://www.magentocommerce.com/wiki/how-to:create-payment-method-module I create a config.xml defining the type of module.

Is there a type of payment gateway that will not display the payment form when you are placing the order? Is there a configuration in this so I can define it to display like the paypal module… I find the paypal module quite complicated to follow as it appears to be doing alot more than I require.

I imagine what I am trying to do is quite simple…

I want exactly the same steps as paypal standard.

1. Finish checkout
2. Go to a page that will redirect to my payment server
3. Have a page that will accept the response and tell the user if the transaction was accepted or declined.

Is there any developer documentation out there letting people know how to do this?

I would really appreciate help on this, I just think I need a small kickstart.

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Honestly, your best bet it to mimic the PayPal Express checkout code in Magento. 

I would recommend that you either take some more time understanding home Magento’s MVC system works or Hire a more experienced programmer to work with you on the task. 

Learning how to write code for Magento is a daunting task and requires an investment of your time to really understand it all.  If you do not have the time or inclination, just contract the work out.  There are several good freelance programmers on the forums, I’m sure one of them would be willing to do the work for you.

(I would recommend Vinai if he has the time)

 
Magento Community Magento Community
Magento Community
Magento Community
 
sicruise
Jr. Member
 
Total Posts:  7
Joined:  2008-11-28
 

I’m a J2EE man generally, I’m sure I’ll figure it out… its more the specific config that I am confused about because I can’t find specific documentation supporting module development.

Thanks for the pointer on the Paypal Express, I’ll have a look into it and see where I get. Is everything related to that module contained in

magento\app\code\core\Mage\Paypal
 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Yes, the PayPal Express code should all be contained in Mage_Paypal.  In particular, look at the ExpressController.php file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tomo
Jr. Member
 
Total Posts:  6
Joined:  2008-10-08
 

I had to do something similar for my payment module and started with PayPay Standard module as a base. How is the redirection done etc. was pretty straightforward to figure out. But the magento part turns out more like a puzzle. And it still continues to “puzzle” me, even when my code works, which is kinda frustrating (apparently it doesn’t hurt to know magento well before starting coding some real thing). Maybe I share some things I found out while writing my module when I find some time.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sicruise
Jr. Member
 
Total Posts:  7
Joined:  2008-11-28
 

Thanks for the pointer in the right direction, I have figured it out by taking the paypal module and changing everything to suit and removing features that I don’t need. Now I’ve to go through the tedious task of renaming all of the classes and folders etc…

I am confused about one thing now though…

This works…

$order Mage::getModel('sales/order')->load($wnOrderId);

This doesn’t…

$order->loadByIncrementId($wnOrderId);

Also the order id returned by

$order->getId();
is the id it was loaded by +1 ... what is this all about?
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top