Check this thread for more info. http://www.magentocommerce.com/boards/viewthread/832/P60/
Introduction |
Each payment method can be done as separate module or few methods can be combined in same module if they share functionality or could be used together.
Let’s create a module with one payment method that will:
Our new module will be called NewModule.
Replace all instances of ‘NewModule’ with name of your module and ‘newmodule’ with simplified code, that contains only alphanumeric characters and underscore.
To make this tutorial most concise, it’s implied that mentioned folders will be created when needed.
Make sure that app/code/local is in include_path.
If you are using configuration cache, don’t forget to clean it after modifying config xml files by deleting the contents of var/cache/config/
Module Declaration |
Create app/etc/modules/Mage_NewModule.xml:
Now that the application is aware of the module, we will let Magento know about details of our module.
Module Configuration |
Create app/code/local/Mage/NewModule/etc/config.xml:
Adapter model |
Note: PaymentMethod name is arbitrary and is up to your decision.
Create app/code/local/Mage/NewModule/Model/PaymentMethod.php:
Now that we have the model let’s give admin a way to configure it and also make checkout process aware of this method.
Declare configuration options for admin panel |
This file will define how you see configuration options in Magento admin panel System > Configuration
Create app/code/local/Mage/NewModule/etc/system.xml:
If you go now to Admin / System / Configuration / Payment Methods, you should see “New Module” group. Enable it and try to checkout. On payment methods page you should see “New Module” payment method with credit card form.
Database updates |
Create app/code/local/Mage/NewModule/sql/newmodule_setup/mysql4-install-0.1.0.php: