====== Create Payment Method Module ====== 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: * accept credit card information * authorize it when order is submitted * save transaction ID in order payment record 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'': true local 0.1.0 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'': Mage_NewModule_Model Mage_NewModule core_setup core_write core_read 0 newmodule/paymentMethod 1 Credit Card (Authorize.net) ===== 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'': 670 1 1 0 select adminhtml/system_config_source_yesno 1 1 1 0 select adminhtml/system_config_source_order_status_processing 4 1 1 0 <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> 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'':