• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Elias Interactive

We Grow Beautiful Websites

  • Blog
  • Show Search
Hide Search

Magento: Create New Payment Method – Cash On Delivery

Lee Taylor · Sep 26, 2008 · 126 Comments

About: How To Create a Magento Custom Module and A “Cash On Delivery” Payment Method
Who’s Interested: Informative to the semi-technically savvy
What: Custom Magento Payment Method

So I’ve seen more and more people raising awareness about desire to create a new payment method that allows orders to be paid via “cash on delivery” or “on pickup” by customer. Is this helpful to companies who sell to local clients? Absolutely. But if you were to click here for info on the diversity of payments, you’d know that this is just the tip of the iceberg.

So in offering a solution, I’ll go ahead and outline what files need to be created and why with hopes to help educate the intigued learner in how to create a Magento Custom Module as well. The benefit in knowing how to do this is modifying existing Magento functionality in a way that it will not be overwritten upon a successful Magento upgrade.

Thus, I’ll jump in. The following 5 files will be created (relative to one’s Magento root folder):

  • config.xml
  • system.xml
  • PaymentMethod.php
  • mysql4-install-0.1.0.php
  • NewModule.xml

Here are their contents (with comments) and relative paths:

app/code/local/Mage/NewModule/etc/config.xml (below)

<?xml version="1.0"?>
<!--
/**
* Elias Interactive
*
* @title	  Magento -> Custom Payment Module for Cash On Delivery
* @category   Mage
* @package    Mage_Local
* @author	  Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/

-->

<config>
<global>
<!-- declare model group for new module -->
<models>
<!-- model group alias to be used in Mage::getModel('newmodule/...') -->
<newmodule>
<!-- base class name for the model group -->
<class>Mage_NewModule_Model</class>
</newmodule>
</models>

<!-- declare resource setup for new module -->
<resources>
<!-- resource identifier -->
<newmodule_setup>
<!-- specify that this resource is a setup resource and used for upgrades -->
<setup>
<!-- which module to look for install/upgrade files in -->
<module>Mage_NewModule</module>
</setup>
<!-- specify database connection for this resource -->
<connection>
<!-- do not create new connection, use predefined core setup connection -->
<use>core_setup</use>
</connection>
</newmodule_setup>
<newmodule_write>
<use>core_write</use>
</newmodule_write>
<newmodule_read>
<use>core_read</use>
</newmodule_read>
</resources>
</global>

<!-- declare default configuration values for this module -->
<default>
<!-- 'payment' configuration section (tab) -->
<payment>
<!-- 'newmodule' configuration group (fieldset) -->
<newmodule>
<!-- by default this payment method is inactive -->
<active>1</active>
<!-- model to handle logic for this payment method -->
<model>newmodule/paymentMethod</model>
<!-- order status for new orders paid by this payment method -->
<order_status>1</order_status>
<!-- default title for payment checkout page and order view page -->
<title>Cash On Delivery</title>
</newmodule>
</payment>
</default>
</config>

app/code/local/Mage/NewModule/etc/system.xml (below)

<?xml version="1.0"?>
<!--
/**
* Elias Interactive
*
* @title	  Magento -> Custom Payment Module for Cash On Delivery
* @category   Mage
* @package    Mage_Local
* @author	  Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/

-->

<config>
<sections>
<!-- payment tab -->
<payment>
<groups>
<!-- newmodule fieldset -->
<newmodule translate="label" module="paygate">
<!-- will have title 'Cash On Delivery' -->
<label>Cash On Delivery</label>
<!-- position between other payment methods -->
<sort_order>670</sort_order>
<!-- do not show this configuration options in store scope -->
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<!-- is this payment method active for the website? -->
<active translate="label">
<!-- label for the field -->
<label>Enabled</label>
<!-- input type for configuration value -->
<frontend_type>select</frontend_type>
<!-- model to take the option values from -->
<source_model>adminhtml/system_config_source_yesno</source_model>
<!-- field position -->
<sort_order>1</sort_order>
<!-- do not show this field in store scope -->
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</active>
<order_status translate="label">
<label>New order status</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<!--<source_model>adminhtml/system_config_source_order_status_new</source_model>-->
<!--<source_model>adminhtml/system_config_source_order_status_processing</source_model>-->
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status>
<allowspecific translate="label">
<label>Payment from applicable countries</label>
<frontend_type>allowspecific</frontend_type>
<sort_order>50</sort_order>
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</allowspecific>
<specificcountry translate="label">
<label>Payment from Specific countries</label>
<frontend_type>multiselect</frontend_type>
<sort_order>51</sort_order>
<source_model>adminhtml/system_config_source_country</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</specificcountry>

<title translate="label">
<label>Title</label>
<frontend_type>text</frontend_type>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</title>
</fields>
</newmodule>
</groups>
</payment>
</sections>
</config>

app/code/local/Mage/NewModule/Model/PaymentMethod.php (below)

<?php
/**
* Elias Interactive
*
* @title	  Magento -> Custom Payment Module for Cash On Delivery
* @category   Mage
* @package    Mage_Local
* @author	  Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/

class Mage_NewModule_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
{
protected $_code  = 'newmodule';
//protected $_formBlockType = 'payment/form_checkmo';
//protected $_infoBlockType = 'payment/info_cod';

/**
* Assign data to info model instance
*
* @param   mixed $data
* @return  Mage_Payment_Model_Method_Checkmo
*/
public function assignData($data)
{
$details = array();
if ($this->getPayableTo()) {
$details['payable_to'] = $this->getPayableTo();
}
if ($this->getMailingAddress()) {
$details['mailing_address'] = $this->getMailingAddress();
}
if (!empty($details)) {
$this->getInfoInstance()->setAdditionalData(serialize($details));
}
return $this;
}

public function getPayableTo()
{
return $this->getConfigData('payable_to');
}

public function getMailingAddress()
{
return $this->getConfigData('mailing_address');
}

}

app/code/local/Mage/NewModule/sql/newmodule_setup/mysql4-install-0.1.0.php (below)

<?php
// here are the table creation/updates for this module

app/etc/modules/NewModule.xml (below)

<?xml version="1.0"?>
<!--
/**
* Elias Interactive
*
* @title	  Magento -> Custom Payment Module for Cash On Delivery
* @category   Mage
* @package    Mage_Local
* @author	  Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/
-->
<config>
<modules>
<!-- declare Mage_NewModule module -->
<mage_NewModule>
<!-- this is an active module -->
<active>true</active>
<!-- this module will be located in app/code/local code pool -->
<codePool>local</codePool>
<!-- specify dependencies for correct module loading order -->
<depends>
<mage_Payment />
</depends>
<!-- declare module's version information for database updates -->
<version>0.1.0</version>
</mage_NewModule>
</modules>
</config>

Again, this serves as a basic configuration for a new payment method that allows Cash On Delivery and is written as a Magento Custom Module, with plenty of options for the live version. Modifying these files may be necessary, though this should be a good outline to get you started. Any help needed, post here and we’ll get some dialogue going to find solutions for your needs.

Or simply download the files here:

Elias: Cash On Delivery (Magento Payment Method)

Share this:

  • Tweet
  • Pocket
  • More
  • Email

Blog, Development Magento, Magento Custom Module, Magento Payment Method, Overwriting Magento Core Code

Reader Interactions

Comments

  1. Branko Ajzele says

    October 8, 2008 at 11:40 pm

    Great work, nice article. Informative and educational. Thank you for sharing it with community.

    Reply
  2. timothyleetaylor says

    October 10, 2008 at 8:46 am

    Branko,

    We’ve been excited about Magento for some time now. We’ve also had a chance to dialogue with you some and gain a better appreciation for your involvement in the Magento community.

    Let us both keep up making progress with Magento on behalf of the community!

    Thanks for the encouragement.

    Hope to connect again soon,
    Lee

    Reply
  3. Tomislav Bilic says

    October 17, 2008 at 6:31 am

    Hey man,
    Many thanks for this tutorial. Looks very helpful to get started.

    Reply
  4. timothyleetaylor says

    October 17, 2008 at 8:08 am

    Thanks Tomislav,

    Great to hear from you, and I do hope this tutorial is beneficial in your endeavor to write a custom payment module.

    I was wondering, would you suggest any other topics about Magento that you’d like to hear or know more about?

    Let’s get a list rolling and begin writing on the most valuable topics the Magento community can benefit from.

    Thanks for your input,
    Lee Taylor

    Reply
  5. Tomislav Bilic says

    October 17, 2008 at 8:16 am

    Hehe. It was a coincidence that I found your article on Google, especially because Branko made the 1st comment. Two of us work at the same office in one small town in Osijek, Croatia and both of us came your way via separate paths 🙂

    Reply
  6. timothyleetaylor says

    October 17, 2008 at 8:31 am

    That coincidence is fun to hear about 🙂

    In that case since you’re working alongside Branko,I recognize much-needed topics that will benefit the Magento community have already been approached in an ongoing manner here: http://activecodeline.com/

    We’re excited for your community involvement, and are glad for the opportunity to contribute as well.

    Feel free to jot down thoughts on topics you’d like to hear about as they come to mind. Nonetheless, we’ll keep on blogging about the design, development, and marketing of Magento!

    Lee

    Reply
  7. osdave says

    November 13, 2008 at 7:32 am

    hi timothy,
    As Tomislav has no suggestion I have one, if I may 🙂
    I’ve learned php with osc: I realize then now that I’m programing in a XXth century way. I’ve discovered Magento and love it and see this an oportunity for me for learning he XXIth century way of programing.

    I’m studying now all I can find about OOP and Zend framework: that isn’t easy but surely worth it.
    Here comes my request: where to start in order to discover Magento’s code? Is there some logic I should keep in mind when I need to find some piece of code I want to see/change?
    You know, a tutorial about Magento’s code for beginers.

    Thanks in advance. Cheers.
    david

    Reply
  8. Branko Ajzele says

    November 13, 2008 at 8:37 am

    Hi there “osdave”… In my modest opinion, Zend Framework is the way to go, especialy if you are interested in Magento. I too am on the path of learning and hopefully mastering Zend.

    There are people who will say Zend is fat as framework, use CodeIgniter, or PHPCake or Symphony or… Whatever the case may be, Zend is recognized as Enterprise ready, it comes with full certification program, it’s documentation is great and so on… in short; you can’t go wrong if you choose to go with Zend.

    Reply
  9. osdave says

    November 13, 2008 at 12:37 pm

    hi Branko, thanks for your comment. Let’s go for Zend then 🙂
    Your blog will also certainly helps me in this journey, see you there

    Reply
  10. timothyleetaylor says

    November 13, 2008 at 2:16 pm

    Hi @osdave and Branko,

    So great to have you both interacting here. I’m just catching onto the dialogue, and think Branko’s got a great perspective on jumping into Magento by initially learning the Zend framework.

    I recognize a couple ways of going about Magento customization. For theme customizations, one can often l learn by comparing the code with the frontend of the theme (via Magento theme notes AND Firefox Firebug tool). In this manner, learning theme customization techniques can be self-learned automatically by adjusting the visual part of the Magento theme.

    But I think you’re referring to Magento core code customization more specifically. And with our combined experience, we agree that learning the Zend Framework (which has made available some great tutorials and videos) is key.

    As you get familiar more with Object Oriented Programming, I believe you’re going to see GREAT value in utilizing the concepts it has to offer. Here’s a link that might get you started actually: http://devzone.zend.com/node/view/id/627

    As I understand it, Magento is written with the intention of not just utilizing the basic OOP concepts, but enhancing code re-usability and efficiency with the Zend Framework.

    They’re still making changes, as we’re all growing alongside them. Let’s keep the dialogue up, and post all kinds of thoughts/questions here and there so we can help each other out.

    All the best,
    Lee

    Reply
  11. osdave says

    November 14, 2008 at 3:29 am

    hi Lee, thanks for answering.
    The link to the devzone seems very interesting for me right now, as I’m revising the base of PHP. I’ll focus on parts 7 and 11 (OOP and XML) as these are both concept I am less confident with and very important for Magento (and I guess for good PHP programing).
    So, thanks again for your time and I’ll check your future posts, keep up the good work 🙂
    cheers, dave

    Reply
  12. Tonitobleroni says

    November 15, 2008 at 2:15 pm

    Hi,
    Thanks a lot for your work, but unfortunately the payment option doesn’s show up in frontend. It does in Admin->Configuration->Payment methods and I have enabled it. Also, I have refresed cache. Any idea what I did wrong? Thanks in advance!

    Reply
  13. timothyleetaylor says

    November 17, 2008 at 2:08 pm

    Hi @Tonitobleroni,

    Thanks for your inquiry. Can I ask what version of Magento you are using? Also, you can try to manually refresh the cache by removing all contents from the following path: var/cache/

    Try that and mention what version of Magento you are using. Make sure the payment option is enabled, and we’ll see what we can troubleshoot from there.

    Thanks,
    Lee

    Reply
  14. timothyleetaylor says

    November 17, 2008 at 2:11 pm

    @osdave,

    That sounds like a great plan for getting started. Also, once you do get an idea for the architecture of Magento (and better seeing at a high-level how everything fits together), you can attempt to go through this payment module piece by piece to see why the code is there and how it interacts with the other files inside the module.

    If you have any questions, post them here. Understanding the module may not seem as overwhelming, and it also plugs right into the Magento code with OOP concenpts (like overriding controllers with OOP practices in mind). Thanks, and all the best with your learning – as I’m doing it right with you every day =) It never stops!

    – Lee

    Reply
  15. Tonitobleroni says

    November 17, 2008 at 2:33 pm

    Hello Lee,
    Thanks a lot for your response. I manually removed all content from the cache folder. I am using 1.1.6. I have enabled the payment option in Admin.
    Thanks in advance!

    Reply
  16. Tonitobleroni says

    November 17, 2008 at 2:34 pm

    …and, needless to say, it still doesn’t show up in frontend…

    Reply
  17. timothyleetaylor says

    November 17, 2008 at 3:00 pm

    Hey @Tonitobleroni,

    Please visit this post and read up about some solutions others have found when dealing with this type of issue: http://www.magentocommerce.com/boards/viewthread/832/P45/#t10489

    Unfortunately, without being able to look into the code you have (as various setup options can be prohibiting this from showing up on the frontend), it is hard for me to troubleshoot. Also, some questions I might cover with you are already located within the forum post mentioned.

    Lastly, if you don’t find any solution there, you may try a quick install of another Magento store and see if the module works from the fresh install.

    I haven’t had time to go in and verify that the code be relevant for Magento version 1.1.6 yet, though I haven’t seen anyone else having a problem with this – so it’s not likely there is any upgrade issues involved.

    Thanks,
    Lee

    Reply
  18. Tonitobleroni says

    November 17, 2008 at 4:17 pm

    Thanks Lee, I will dig through the post you provided. Thanks for your help!

    Reply
  19. sirvash says

    November 18, 2008 at 5:17 am

    Hi,

    Could you suggest me how to configure the this module in own magento application. when i putted the all files in my local system this is not overriding the default shipping method of magento.

    Reply
  20. timothyleetaylor says

    November 18, 2008 at 1:15 pm

    Hi @sirvash,

    I’d love to recommend how to configure this module in your own Magento application, though with all the possibilities, it would probably turn into a small project rather than a couple discussions.

    In reference to the issue you mentioned, make sure you haven’t changed the name of the default shipping method of Magento. Also, I’d recommend going back and make double-checking that the files were copied into the correct folders (reference the paths in the download we have available).

    Please contact us via our contact form below if you’d like help on a project, and we’d be glad to assist you.

    Thanks!
    Lee

    Reply
  21. Sirvash says

    November 18, 2008 at 11:23 pm

    Hi @Lee,

    Special Thanks for quick solutions i am trying to update the title of ‘Cash on Delivery’ and updated the system.xml and config.xml but modification not visible on front.

    Please assist me.
    module working fine now can i update the shipping method i just wanna to save and extra value instead of the ‘Flat Tax’ on sales order table.

    Thanks
    Sirvash Sharma

    Reply
  22. timothyleetaylor says

    November 19, 2008 at 2:50 pm

    Hi @Sirvash,

    We’ve had someone else inquire as to a similar issue. My response can be found here: http://eliasinteractive.com/blog/magento-create-new-payment-method-cash-on-delivery/#comment-64

    Thanks,
    Lee

    Reply
  23. Leslie says

    December 10, 2008 at 4:02 pm

    Hi Folks,

    I see that this thread is for COD but I’m also attempting to create a Magento payment module for USAePay payment module using the Magento create payment gateway instructions.

    I am having a parser error issue with the
    app/code/local/Mage/Usaepay/Model/PaymentMethod.php file and I wonder if you could help me fix it. If yes, could I send you the php code for this file? Here is the error:

    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity:
    line 133: parser error : Opening and ending tag mismatch: usaepayach line 107 and payeach in
    /home/the/domains/silverborn.com/public_html/lib/Varien/Simplexml/Config.php
    on line 500

    Thank you,
    Leslie

    Reply
  24. Pankaj says

    December 26, 2008 at 12:09 am

    I have made this but it is looking in the advanced section but not in the payment method in the Admin panel.I need it with the credit card details.

    Reply
  25. Thirupathi says

    January 2, 2009 at 8:07 am

    I had created Payment Module as it is in my local system
    Magento: Create New Payment Method -> Cash On Delivery

    but the new module is not displaying in admin/system/configuration

    same as another one created fallowed by

    http://www.magentocommerce.com/wiki/how-to/create-payment-method-module

    it is also same problem

    please any one suggest me what is the problem

    Reply
  26. Nishant says

    January 4, 2009 at 10:15 pm

    hi can u tell me how can i add another field to new product addition(Create product setting.)..m using version 3.0

    Reply
  27. nishant says

    January 4, 2009 at 10:32 pm

    hi!
    i just want to know how can i know which file is showing the current page content of magento so that if i want to modify it then i can do it….
    And yes dear m just a beginner…

    Reply
  28. Younus says

    January 11, 2009 at 6:15 am

    Hi Lee,

    I’m using magento-1.1.8. I’ve followed your steps creating 5 files in appropriate directories. But unfortunately in Admin->Configuration->Payment methods, I can’t see any update. I have refreshed cache but no results. Can you say please where I’m doing wrong ?
    Thanks in advance.

    Reply
  29. timothyleetaylor says

    January 16, 2009 at 12:09 am

    Hi All,

    As I see, there’s been a bit of activity that I haven’t had time to get to. My apologies here. I haven’t needed to update this for Magento’s new 1.2 version, so I haven’t tested it against the upgrades Magento has made. Unfortunately, I haven’t had time to update it – though I assume there’s some adjusting to the “system.xml” file regarding displaying correctly within the Admin->Payment Methods.

    I’ll post again when time opens up. Until then, keep testing and post your successful findings on the blog here!

    Thanks for all community contributions,
    Lee

    Reply
  30. neo says

    February 22, 2009 at 8:25 pm

    Hi, I just tried your post, but it’s not shown in configuration->payment methods tab but in configuration->advanced tab. My magento version is 1.2.1.
    Can u show me the solution.
    Thanks in advance.

    Reply
  31. neo says

    February 22, 2009 at 11:40 pm

    I had some wrong but I fixed it and now it’s shown in payment methods tab. It’s really great work. Thank you very much, Lee!

    Reply
  32. Eddie says

    February 26, 2009 at 12:01 pm

    Hi,
    Thanks for this tutorial. However, when I do an order from within admin, the COD payment method is not available, even tho’ I’ve enabled in Configuration.

    I’m running ver 1.2.0.3. Any suggestions?

    Thanks,
    Eddie

    Reply
  33. Ela says

    March 6, 2009 at 4:25 am

    Hola,

    Thank you very much for this tutorial! It works fantastic! Just a little question: The new payment is the first one in the frontend now. How can I change the sort order? Thanks! ela 🙂

    Reply
  34. Sabarish says

    March 21, 2009 at 4:51 am

    hi timothyleetaylor,

    I am New to this both Magento and Zend Framework. I Just tried ur Steps to create a payment module. Unfortunately i cant able to succeed in it. its throwing me a warning…

    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : XML declaration allowed only at the start of the document in E:\magento\lib\Varien\Simplexml\Config.php on line 500

    can u please tell me wr i did a mistake and how to resolve this.

    Thanks & Regards,
    Sabarish V

    Reply
  35. Lee Taylor says

    March 22, 2009 at 9:14 pm

    Hey there @Sabarish,

    That error tends to be a result of something going wrong within your config.xml or system.xml file inside the module directory. Be sure to check unnecessary whitespace and invalid characters (which happens sometimes if copying and pasting).

    Hope you find a solution that results from digging around those two files.

    Cheers!
    Lee

    Reply
  36. Younus says

    March 22, 2009 at 9:49 pm

    Hi Sabarish,

    You can go through the following link to integrate the New Payment Method.

    http://www.magentocommerce.com/boards/viewthread/832/P195

    I’ve integrate the method with magento 1.1.8.
    Its also working with ver-1.2.0.3.

    Thanks
    Younus

    Reply
  37. Lee Taylor says

    March 22, 2009 at 9:56 pm

    Thanks for the input here all!

    Reply
  38. Sabarish says

    March 25, 2009 at 5:01 am

    HiYounus,

    Thanks for the Input Its works fine for me. Sorry for the late response Bcoz i was struck with other works. Again i need another input from u all guys. How to integrate the new Module with the Existing Modules. Do u have any reference link kindly let me know

    Thanks & Regards,
    Sabarish

    Reply
  39. eshban says

    April 19, 2009 at 12:13 pm

    thanks for this tutorial, i need a little guidance.

    I need to create a magento module that sends variables to a payment gateway page.

    Can you please guide me in this regard?

    Reply
  40. Marcio says

    April 20, 2009 at 2:17 pm

    Hy

    I create a field

    ‘

    In

    class Cerebrum_Visa_Block_Standard_Form extends Mage_Payment_Block_Form

    Ok, appear in Font-End in E-commerce

    ————
    But

    How to get the variable “visa_type” content, to Show in the E-commerce

    Reply
  41. dan says

    May 5, 2009 at 5:35 am

    What about giving only special customers the option of cash on delivery?

    Reply
  42. dan says

    May 5, 2009 at 5:38 am

    What I mean is, say I have a list of user accounts maintained through the admin panel. What then if I create a group called “vips” and then only when they are logged in they can see the payment option “Cash on Delivery”.

    We would not want to deliver a heavy valuable package to someone whom we did not trust to give them the COD treatment!

    Reply
  43. Linus says

    May 13, 2009 at 6:29 am

    This is great if it works, can´t you release it on magento connect?

    Reply
  44. vas says

    May 26, 2009 at 12:23 am

    Hi, all

    I have created new payment module. it display on admin panel as well as on frontend. now i want that when user click on place order user will redirect to new window like any iframe and in that user will enter all the details and continue….

    pls anyone help me how to do this….. pls..pls…

    thanks,

    Reply
  45. anonymousmagentonewbie says

    May 26, 2009 at 3:21 am

    does this work with magento 1.3+ ?

    Reply
  46. vas says

    May 30, 2009 at 4:59 am

    No one has answer of my question??? regarding redirect to new iframe for payment.

    Reply
  47. Helen says

    June 1, 2009 at 3:31 pm

    This is somewhat off topic, but I haven’t been able to get any help at the Magento forums.

    Sounds like you know what you’re doing, maybe you know the deal with this?

    Thanks in advance!

    Here’s my issue:

    – I added a new module using ModuleCreator.

    – Was able to activate it via Configuration -> Advanced.

    – The new module MENU tab shows up in the Admin section, but when I click on the button, it takes me to a blank page.

    – I’m using “default” theme for the backend, and a custom theme for the frontend. However, this new button takes me to a blank page styled using my custom theme.

    So my question is—where can I see this custom module admin page? Is it a php, xml or phtml file?

    I want to add content to it, and if possible, change it to “default” theme like the rest of the admin section.

    Reply
  48. mushir says

    June 10, 2009 at 3:19 am

    how can i add one new form before registration page on front-end for magento ?

    when customer can click on registration first of all open new form where customer can enter city name and that city will be in system then register form will appear otherwise display sorry msg.

    pls help me

    http://mushirkureshi.blogspot.com

    Reply
  49. khushwant says

    June 11, 2009 at 12:35 pm

    Hello Lee,

    I m new to magento. Can u give me a good and easy resource to get started with magento and zend.

    Thanks
    khush

    Reply
  50. alp says

    July 12, 2009 at 5:28 am

    Thanks for this great tutorial! How can i set up the script to send notification mail which informs customer after “cash on delivery” order. Briefly, i need custom mail template and the required mail script for cash on delivery. I also want to be in bcc as an admin.
    Any help will be appreciated

    Reply
  51. jazkat says

    July 20, 2009 at 8:40 am

    Heya guys,
    first I must say I really appreciate your effort in serving Magento community! That goes for Croatian team as well!

    I am also interested in knowing whether this module works in 1.3.x. I am gonna try it anyway and let you know the results.

    However, I am still kinda confused about Magento updates. The thing is I am modifying the system quite a bit plus thinking of using lots of extensions. I mean, I am aware the system needs to stay safe, however, the possibility of having to modify code after every update makes me, well, not happy.
    Anyway, I know this is a different topic, it just bothers me extensively.

    Reply
  52. freshwebservices says

    July 21, 2009 at 1:02 am

    Hi jazkat,
    If you use your own modules to modify Mage behaviour/functionality, then you have less to worry about when upgrading. However, if you modify core code, then this is a problem when upgrading – you’ll have to use a diff tool to compare the new code against your modified version and then merge the 2 if you can.
    So if possible, figure out how to create your own module to do modifications – often ‘all’ you have to do is copy the file you want to modify into app/code/local/yourfolder and then publish it as a module, having informed Mage to use your module rather than the default.
    Best wishes,
    Eddie

    Reply
  53. jazkat says

    July 23, 2009 at 7:54 am

    Hi Eddie,
    thanks a lot, this makes sense. I was actually going to create my own modules and not change core files, so that means I was on the right path not to complicate my life 🙂
    You put my mind at ease 🙂

    Reply
  54. Abdul says

    July 28, 2009 at 2:42 am

    Hi all,

    This is great tutorial to get started. I’ve an assignments. I need to build a custom module in magento. I’m new to magento. I need to build a clone of http://www.brooksbrothers.com/selectshirts/selectshirts.tem#. Can anybody guide me how to start this kind of module/functionality in magento. Hope to hear from you people. Thanks in advance.

    Reply
  55. Lee Taylor says

    July 28, 2009 at 1:10 pm

    Hi All,

    Glad all is well and things are getting sorted. Thanks for helping out everyone. We have been busy working on a few internal projects that we’ll look forward to presenting to the Magento community soon.

    Keep up the progress!

    Cheers!
    Lee

    Reply
  56. Lee Taylor says

    July 28, 2009 at 1:11 pm

    Hi @Abdul,

    From the link you gave us, it looks like this kind of functionality is more related to a “product configurator” rather than an actual payment gateway. The payment gateway would need to happen once the products are added to the cart and the user is sent to the checkout process.

    All the best in finding the right solution!

    Cheers,
    Lee

    Reply
  57. Abdul says

    July 29, 2009 at 12:09 am

    Hi @Lee Taylor,

    Thanks for reply.

    Reply
  58. pippo says

    August 3, 2009 at 9:33 am

    hi! i configured the module and works fine, but i would like that my country selection for the cash on delivery availability, refers to shipping country, not the billing one. someone can help me? thanks in advance

    Reply
  59. Juan Siesquen says

    August 3, 2009 at 4:12 pm

    Hi Men!

    I want to create a payment module which can communicate to a web service. I have problems displaying lists of coins recovered dynamically. Any idea?

    When ending the develop I publish… excuse me my english. 😛

    Regards Friends!

    Reply
  60. Peter Money Maker says

    August 7, 2009 at 7:24 am

    Great idea, thanks for this tip!

    Reply
  61. Vishnu Bhatia says

    August 16, 2009 at 8:49 am

    Dear Timothy,

    First of all thanks a lot for the module. I have installed it on Magento 1.3.1 and it work great. We have added an additional fee as COD charges and it works great on front end. However, the problem comes when I have to modify an existing order or create a new order. It simply does not count the additional charges and the total of the order is having only the shipping charges added. Can anyone who has faced the similar issue, guide me how to solve this issue?

    Regards.

    Reply
  62. Pavel says

    August 25, 2009 at 10:19 am

    Thank you so much for valuable information.

    Is there some easy way to add suplemental fee for this payment method.

    Reply
  63. Ron Peled says

    August 28, 2009 at 6:17 pm

    I think your post does a better job explaining how to create a payment module for magento that the wiki page they have on the magento community site. Good job!

    Reply
  64. Rohan says

    September 12, 2009 at 5:38 pm

    Totally agree with Ron above. The Magento wiki is complete crap by comparison.

    One question I have which is confusing the hell out of me, is about the PaymentMethod.php file.

    How does this file get referenced by the payment method?

    The only reference I can find to it is in the config.xml file which says:

    newmodule/paymentMethod

    there is a folder called

    app\code\local\Mage\NewModule\Model

    and inside of that there is PaymentMethod.php

    is this the same file that is referenced in config.xml ??

    Reply
  65. yogesh says

    September 14, 2009 at 7:10 am

    Hello,
    This is nice tutorial but can you please provide me any help on how to create credit card accepting payment module for magento.
    I followed some url’s but they all are very basic and not even with any information like how to pass hidden values from client side while checkout..How to change fields name etc…
    Please help me asap…

    Reply
  66. Rianti says

    October 1, 2009 at 9:29 am

    Hi, thanks for this. I’ve implemented it on v 1.2.1.2 and it works great! 🙂 I’ve also added a new “message” field to this module (“Please call xxxxxxx to arrange delivery time”). It shows up in admin but doesn’t show the message when I choose this payment method on checkout. Anyone can help me with this?

    Much appreciated,

    Rianti

    Reply
  67. momleepost says

    October 8, 2009 at 7:35 am

    We like to know how to the custom payment redirect to the payment process url when we submit the place order button.

    Reply
  68. Ajax and PHP Developer says

    October 13, 2009 at 11:01 am

    Hey,

    I was building a checkout module and this helped figure out some dearly needed stuff. It is just a bit off from what I need but I learned a lot. Thank you.

    Reply
  69. Aryan-Ali says

    October 28, 2009 at 1:08 am

    Great work dear
    can any one guide me about ?
    how can i add the realted data base tables?
    or how many tables are required for this module ?

    please anser me as soon as posible ………..!

    Reply
  70. ertarunz7 says

    November 2, 2009 at 2:07 am

    Hello All,

    I’m new to Magento .. and i want to develop a module
    “Vendor rating system like that of ebay”.. In Magento .. can any when suggest me where to start from .. As i had no idea regarding this .

    Any help will be great ..

    Thanks a lot in advance.

    Reply
  71. Bruno Alexandre says

    January 4, 2010 at 12:36 pm

    Can you please make downloadable file available.

    Thank you and Congrats for the article.

    Reply
  72. Thillai says

    January 28, 2010 at 12:54 am

    Hi

    I downloaded the module its working fine in magento with single admin site. When i use the module with multiple websites , am getting an error message in the backend . But the module is working fine in the frontend.Update me and let me know the what the issue is and how can i resolve this issue.

    Reply
  73. Maz says

    January 29, 2010 at 4:53 am

    Hello, I am new on this. I created a module using your tutorial but after creating the module I couldn’t enter to my admin panel..it shows following error.

    Module “mage_PaymentModule” requires module “mage_Payment”

    Help is highly appreciated! Thanks!

    Reply
  74. Bill Thomas says

    February 9, 2010 at 5:52 pm

    Maz:
    The problem is probably in the app/etc/modules/Mage_NewModule.xml

    mage_Payment needs to be Mage_Payment. Capital M

    Reply
  75. optical says

    March 11, 2010 at 7:11 am

    I’m trying to create multiple modules using the same template but I notice the subsequesnt ones are not showing. It’s enabled and I get no errors. Is it a sort number value issue?

    Reply
  76. optical says

    March 11, 2010 at 7:15 am

    let me rephrase my question. If I need to create multiple new methods, which variable will I need to change? I changed the NewModule variable but I can only get one method to show up in the backend. The other new method shows it’s enabled in Advanced but I dont’ see it on the Payment Methods.

    Reply
  77. ben says

    April 9, 2010 at 11:53 am

    Although I am writing a custom payment module for Magento (what a learning curve!) which is a bit more complicated stuff, I would appreciate some advice. After creating the module I can setup my custom setting of the created payment method in the Payment Methods Magento admin section, but when I enable the payment method and go to the checkout, the Payment Information doesn’t contain the option for my enabled payment option. I have disabled the cache while debugging, so it can’t be the fault. cheers

    Reply
  78. Charles G says

    April 21, 2010 at 4:57 am

    Hello Lee,

    Many thanks for this contibution.
    I have managed to add a new payment method based on your tutorial and I am very happy with it.
    The only problem I have with any new payement modules I write from scratch is that they will cause an error in the admin panel when you attempt to check an order/change the status of an order that was placed using this payement.
    So In the admin section , if I go to sales/orders and try to edit the last order made with the newpayement I get this error:

    Warning: include(/home1/……/app/design/adminhtml/default/default/template/POD1/info.phtml) [function.include]: failed to open stream: No such file or directory in /home1/… …//app/code/core/Mage/Core/Block/Template.php on line 144

    Any idea how I can resolve that little bugger ? Is the module missing some template files in the adminhtml ?

    Thanks

    Charles G

    Reply
  79. Jose says

    April 29, 2010 at 8:18 am

    Hello Elias,

    Do you konw if is posible disable this option of payment for downloadable and Virtual products?

    Thanks 🙂

    Reply
  80. J.S. Coolen says

    May 14, 2010 at 11:32 am

    The download link doesn’t wotk anymore, does anyone has the files for me?

    Reply
  81. rover says

    July 12, 2010 at 2:58 am

    Hi,

    Everyone, I’m new here and in Magento. Can you give me an idea how to integrate or create new payment module mehod PesoPay. Like what I said, I’m new in Magento and I really can’t caught an idea where and how to start creating this module. Thank you very much for the help.

    Reply
  82. rover says

    July 13, 2010 at 11:28 pm

    Hi,

    I just want to ask that how and where is the module of paypal payment method where it send the buyers information and total amount of the customer’s bought product. Please help me with this. Thank you in advance.

    Reply
  83. rover says

    July 14, 2010 at 1:47 am

    Hi,

    Guys, I having a problem when I clicked “Checkout: in my magento.

    Fatal error: Call to a member function setStore() on a non-object in C:\xampp\htdocs\magento\app\code\core\Mage\Payment\Helper\Data.php on line 72

    anyone can help? Thank you

    Reply
  84. jeet says

    July 14, 2010 at 9:27 am

    I need to integrate a new payment module called ‘MegaPos’ . Dont know how to move. any help would be highly appreciated.

    Reply
  85. Sunil Mohapatra says

    July 17, 2010 at 2:38 am

    I desperately need the multi payment gateway module called ‘Megapos’.Please need some help.

    Thanks…

    Reply
  86. kivin says

    August 5, 2010 at 5:28 am

    my modudle going error, here show:
    Module “mage_NewModule” requires module “mage_Payment”
    Trace:
    #0 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\code\core\Mage\Core\Model\Config.php(680): Mage::throwException(‘Module “mage_Ne…’)
    #1 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\code\core\Mage\Core\Model\Config.php(645): Mage_Core_Model_Config->_sortModuleDepends(Array)
    #2 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\code\core\Mage\Core\Model\Config.php(233): Mage_Core_Model_Config->_loadDeclaredModules()
    #3 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\code\core\Mage\Core\Model\App.php(263): Mage_Core_Model_Config->init(Array)
    #4 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\Mage.php(434): Mage_Core_Model_App->init(”, ‘store’, Array)
    #5 D:\Program Files\Zend\Apache2\htdocs\magento1324\app\Mage.php(455): Mage::app(”, ‘store’, Array)
    #6 D:\Program Files\Zend\Apache2\htdocs\magento1324\index.php(65): Mage::run()
    #7 {main}

    Reply
  87. nabler says

    August 5, 2010 at 10:05 pm

    Yeah i got the pretty error after i follow your tutorial….I use magento 1.4.0.1

    Reply
  88. Vasashiner says

    August 18, 2010 at 7:56 pm

    Module “mage_NewModule” requires module “mage_Payment”
    Trace:
    #0 E:xampphtdocsvasa_magentoappcodecoreMageCoreModelConfig.php(680): Mage::throwException(‘Module “mage_Ne…’)
    #1 E:xampphtdocsvasa_magentoappcodecoreMageCoreModelConfig.php(645): Mage_Core_Model_Config->_sortModuleDepends(Array)
    #2 E:xampphtdocsvasa_magentoappcodecoreMageCoreModelConfig.php(233): Mage_Core_Model_Config->_loadDeclaredModules()
    #3 E:xampphtdocsvasa_magentoappcodecoreMageCoreModelApp.php(263): Mage_Core_Model_Config->init(Array)
    #4 E:xampphtdocsvasa_magentoappMage.php(434): Mage_Core_Model_App->init(”, ‘store’, Array)
    #5 E:xampphtdocsvasa_magentoappMage.php(455): Mage::app(”, ‘store’, Array)
    #6 E:xampphtdocsvasa_magentoindex.php(65): Mage::run()
    #7 {main}

    Reply
  89. Vsven says

    October 26, 2010 at 6:08 am

    Hi Guys,

    This works PERFECT!! Just one thing, you have to change the title of “NewModule.xml” to “Mage_NewModule” otherwise it doesn’t work 😉

    cheers
    vsven

    Reply
  90. Mage_New says

    December 30, 2010 at 10:20 pm

    Hi there.. nice module. But i’m unable to get these to show up on my multilingual site.. I can only see this in the payment methods when Current Configuration scope to Default Config or Main website. When I switch to the rest of the 3 languages, I can’t see any.

    Any help?

    Using magento 1.1.4 and modern theme.

    Reply
  91. Ssankarsiva says

    January 13, 2011 at 10:39 am

    Greate work

    Reply
  92. Mahesh Umarane says

    January 13, 2011 at 3:21 pm

    great work

    Reply
  93. Phumlani Nyati says

    March 30, 2011 at 12:44 pm

    I am new to this but I have disabled the cash on delivery module on my admin dashboard but it still appears on my site, how can I solve this problem? please help!!!

    Reply
  94. Bharat Paghadal says

    April 8, 2011 at 6:39 am

    woww, great work.

    but i want to implement this module with paymentgateway,
    so how can i implement???

    Reply
  95. Zekia says

    April 12, 2011 at 8:42 am

    This is a very helpful post but could you also explain which tags and file-names should be changed in order to create a second new payment method?

    Reply
  96. Daisy says

    April 14, 2011 at 11:20 am

    I have to place the order details to the Warehouse server using the Web-service functions, when ever a new order is placed. I want to write a module to call web-service functions. Please suggest the solution.

    Reply
  97. magento themes says

    April 15, 2011 at 5:28 am

    Very good idea………Thanks for adding this topic. We are also working on Magento.No w it will help to add this feature.

    Reply
  98. Kiran says

    April 18, 2011 at 2:40 pm

    Great and Thanx but small correction….
    mage_Payment Should be Mage_Payment
    mage_NewModule Should be Mage_NewModule

    Reply
    • Palmer Del Campo says

      December 29, 2014 at 11:26 pm

      This solves the error that everybody mentions on this thread

      Reply
  99. Ronniee says

    June 8, 2011 at 7:38 am

    It helps me a lot, thanks, great work.

    Reply
  100. Mit says

    June 14, 2011 at 5:11 am

    HI dear it works but can i make separate table for this module and how plz tell me.. 

    Reply
  101. Vivekasc says

    June 28, 2011 at 6:42 am

    Hello Friends,
    I am looking for a prestashop module to integrate in magento.
    Prestashop module in here
    http://socolissimo.prestashop.common-services.com/
    Please guid me how i can integrate this in magento.

    Thanks in Adavance
    Vivek Shrivastava

    Reply
  102. web development bangalore says

    July 1, 2011 at 7:22 am

    Great work.Very helpful post.Thanks for  sharing

    Reply
  103. Magento One Page Checkout says

    September 28, 2011 at 11:55 am

    This is an excellent post! Thanks for the information! If anyone needs  Magento Stores  one page checkout  Module , let me know

    Reply
  104. Omer Bohoussou says

    October 20, 2011 at 2:42 pm

    I don’t see any thing , I do not know where to go to see if it work. help me please

    Reply
  105. management information system says

    October 28, 2011 at 7:52 am

    I want to know more about majento ..can u share with me some knowledge

    Reply
  106. Manish Prakash says

    October 29, 2011 at 5:18 am

    I have written a detailed blog post here on how to create payment method in magento
    http://www.excellencemagentoblog.com/magento-create-custom-payment-method

    Reply
  107. Vahan403 says

    December 27, 2011 at 4:47 pm

    Hi I am new in magento and will be appreciate if you will help me.
    My question is which method executes when checkout button is pressed? 
    I am trying develop new online payment module and need redirect user to the payment gateway site when checkout is made

    Reply
  108. Denisa says

    March 18, 2012 at 11:37 pm

    Thanks for posting! I have a question: did you create a cash in advance module? It should be something similar with this, isn’t it?
    Thanks

    Reply
  109. Omar Farooq says

    April 11, 2012 at 11:13 am

    Not worked. Can you please available the download files link

    Reply
  110. Magento One Page Checkout says

    April 26, 2012 at 7:01 am

    Hello Lee, I came on your blog for the first and I have seen your work. I must say you have maintained your Blog really well. Good on you.  

    Reply
  111. Omar Farooq says

    May 15, 2012 at 7:25 am

    i need to add cash handeling fee how can i add this

    Reply
  112. Shaima Arshad says

    June 1, 2012 at 7:04 am

    Module “mage_NewModule” requires module “mage_Payment”. i m finding this error

    Reply
  113. Russel adword says

    December 2, 2013 at 12:29 pm

    eCommerce businesses work hard to win the attention of shoppers and bring them to their websites. At the same time, they have invested substantial budget and effort to present the most compelling shopping experience possible. From Web2.0 and social media features to engaging video ads and product configurations, each eCommerce business strives to stand out from the competition to boost sales and maintain consumer loyalty.

    http://www.cloudways.com/en/magento-managed-cloud-hosting.php

    Reply
  114. magentony says

    January 10, 2014 at 4:52 am

    My only discrepancy is that the COD option will be available for downloadable and virtual products, which is not logical since there is no address to deliver a virtual product to. Can you specify COD based on product type?

    Reply
  115. Muhammad Ahsan Horani says

    January 30, 2015 at 11:14 am

    Thank you for the article. I am having problem while following above article. My Custom payment method is not being displayed on the front end. Any suggestions ? I have done everything same as above

    Reply
    • Eric Clark says

      January 30, 2015 at 8:09 pm

      What version of Magento are you using? This was written for an older version.

      Reply
      • Muhammad Ahsan Horani says

        January 31, 2015 at 6:34 am

        I am using Magento 1.9.1
        But I have managed to sort it out. Works fine. Thank you Eric !

        Reply
        • Pavel Adrian says

          March 26, 2015 at 2:39 pm

          Can you tell me how to solve this?

          Reply
  116. Pankaj says

    March 1, 2015 at 4:30 am

    Hi ,

    Thanks for nice article ,i have doubt that you have mention app/code/local/Mage/NewModule/etc/config.xml but when i check magento there is no such file, can you tell me whatever allcode you have mention we need to create new page into particular directory or wat else.

    2.the download link is not working , kindly check and give correct link

    Thanks

    Reply
    • Eric Clark says

      March 1, 2015 at 4:32 pm

      Pankaj, the download link has been fixed. Thanks for letting me know. Please keep in mind this customization was written for an older version of Magento. YMMV.

      Reply
  117. Rahul Chauhan says

    June 4, 2017 at 10:53 pm

    Hi Lee thanks for a great post just wanted to know How I can add a Fee applicable for this payment method. Suppose I use this payment method for COD which has a defined cost. So How I can add the applicable cost to the subtotal of the order customer going to place.

    Thanks

    Reply
  118. Tarunjeet singh says

    November 30, 2017 at 10:33 am

    Hi ,
    i am trying to create partial cash on delivery method where i can enter amount while selecting payment method on checkout and get its order status in processing…

    Thanks in advance

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

From the blog

Magento SVN Usage – Best Practices

How to Create Reusable Apple Mail Templates [video]

I’d rather buy from Harry Potter

The Ecommerce Solution You’ll Find Refreshing (drumroll)

Liberating Constraints

More Posts

Connect with us

  • Facebook
  • RSS
  • Twitter
Affiliate Disclaimer

© 2025 · Elias Interactive · Built on the Genesis Framework

  • Blog
  • Affiliate Disclaimer
  • Home