Custom Payment Gateway Module inMagento
Payment Gateway is most important section of any eCommerce or Shopping website.
Wh...
<Mage_Payment />
</depends>
</CompanyName_EzeePayment>
</modules>
</config>
2. Create xml file app/code/local/CompanyName/...
<setup>
<module>CompanyName_EzeePayment</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</ezeepayment_s...
<!-- default title for payment checkout page and order view page -->
<title>Credit Card (Authorize.net)</title>
<cctypes>A...
//Can void transactions online?
protected $_canVoid = true;
//Can use payment method internal in admin panel?
protected $_...
<groups>
<!-- ezeepayment fieldset -->
<ezeepayment translate="label" module="paygate">
<!-- For title 'Ezee Payment' -->
...
<label>Title</label>
<frontend_type>text</frontend_type>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<...
<?php
$this->startSetup();
$this->run("UPDATE SQL HERE");
$this->endSetup();
Note :
1. Make sure in your system app/code/l...
Upcoming SlideShare
Loading in …5
×

Custom payment gateway module in magento

3,575 views
3,379 views

Published on

Payment Gateway is most important section of any eCommerce or Shopping website. Where user can purchase and pay by using Credit Cards online. Magento base code developed in Zend Framework Module structure. Here developer can developed modules and extensions as per there requirement and use or re-use.

2 Comments
0 Likes
Statistics
Notes
  • Such post seemingly sounds to be very beneficial to Magento developers! Making payment gateways is an action that has to be done with logics in addition to technical skills used, keeping in mind that where in future we may require sort of steps to be well adapted with order transactions done on site. It is always to be a good practice to make sure that authorize and capture are properly integrated along with various processes including invoicing and refunding the orders, especially in case of order cancellation (e.g. wrong order placement, orders reached in broken conditions).
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Ezeelive Technologies (Magento Development Company in India) has expert team in custom magento theme design, reponsive magento ecommerce portal development and magento customization india. We developed and implement custom module, extension and plugin as per project or client requirement.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total views
3,575
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
90
Comments
2
Likes
0
Embeds 0
No embeds

No notes for slide

Custom payment gateway module in magento

  1. 1. Custom Payment Gateway Module inMagento Payment Gateway is most important section of any eCommerce or Shopping website. Where user can purchase and pay by using Credit Cards online. Magento base code developed in Zend Framework Module structure. Here developer can developed modules and extensions as per there requirement and use or re-use. A payment gateway system mostly do : A. valid and accept credit card detail B. autherise payment detail when submit order detail C. Save Transaction ID along with user detail in Order So lets create a Custom Payment Gateway Module in Magento in below steps, here our module name is EzeePayment : 1. Create xml file in app/etc/modules/CompanyName_EzeePayment.xml for Module declarate: <config> <modules> <CompanyName_EzeePayment> <active>true</active> <codePool>local</codePool> <depends>
  2. 2. <Mage_Payment /> </depends> </CompanyName_EzeePayment> </modules> </config> 2. Create xml file app/code/local/CompanyName/EzeePayment/etc/config.xml for module configuration: <?xml version="1.0"?> <config> <modules> <CompanyName_EzeePayment> <version>0.1.0</version> </CompanyName_EzeePayment> </modules> <global> <blocks> <ezeepayment> <class>CompanyName_EzeePayment_Block</class> </ezeepayment> </blocks> <!-- model for ezeepayment module --> <models> <ezeepayment> <class>CompanyName_EzeePayment_Model</class> </ezeepayment> </models> <!-- setup for ezeepayment module --> <resources> <!-- identifier --> <ezeepayment_setup>
  3. 3. <setup> <module>CompanyName_EzeePayment</module> </setup> <connection> <use>core_setup</use> </connection> </ezeepayment_setup> <ezeepayment_write> <connection> <use>core_write</use> </connection> </ezeepayment_write> <ezeepayment_read> <connection> <use>core_read</use> </connection> </ezeepayment_read> </resources> </global> <!-- default configuration values for this module --> <default> <!-- 'payment' configuration section --> <payment> <!-- 'ezeepayment' configuration group --> <ezeepayment> <!-- by default this payment method is inactive --> <active>0</active> <!-- model to handle logic for this payment method --> <model>ezeepayment/paymentMethod</model> <!-- order status for new orders paid by this payment method --> <order_status>pending</order_status>
  4. 4. <!-- default title for payment checkout page and order view page --> <title>Credit Card (Authorize.net)</title> <cctypes>AE,VI,MC,DI</cctypes> <payment_action>authorize</payment_action> <allowspecific>0</allowspecific> </ezeepayment> </payment> </default> </config> 3. Now create EzeePayment Model php file in app/code/local/CompanyName/EzeePayment/Model/PaymentMethod.php : <?php class CompanyName_EzeePayment_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc { protected $_code = 'ezeepayment'; //payment method (online auth/charge) ? protected $_isGateway = true; //authorize online? protected $_canAuthorize = true; //capture funds online? protected $_canCapture = true; //capture partial amounts online? protected $_canCapturePartial = false; //Can refund online? protected $_canRefund = false;
  5. 5. //Can void transactions online? protected $_canVoid = true; //Can use payment method internal in admin panel? protected $_canUseInternal = true; //Can show payment method as an option on checkout payment page? protected $_canUseCheckout = true; //Is this payment method for multiple shipping checkout? protected $_canUseForMultishipping = true; //Save credit card detail for future processing? protected $_canSaveCc = false; //Here you will need to code for authorize, capture and void public methods payment gateway } ?> In this above class now we have to do actual code for communicating payment gateway. If in admin panel you have selected “Authorize Only”, then authorize method will be called. If you have chosen “Authorize and Capture then only the capture method will be called 4. Now create system xml file app/code/local/CompanyName/EzeePayment/etc/system.xml for Declare configuration options in magento admin panel : <?xml version="1.0"?> <config> <sections> <!-- payment tab --> <payment>
  6. 6. <groups> <!-- ezeepayment fieldset --> <ezeepayment translate="label" module="paygate"> <!-- For title 'Ezee Payment' --> <label>Ezee Payment</label> <sort_order>670</sort_order> <!-- not to show 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> <!-- active for website? --> <active translate="label"> <label>Enabled</label> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model> <sort_order>1</sort_order> <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_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> <title translate="label">
  7. 7. <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> </ezeepayment> </groups> </payment> </sections> </config> 5. Create SQL Installer file app/code/local/CompanyName/EzeePayment/sql/ezeepayment_setup/mysql4-install- 0.1.0.php: <?php $this->startSetup(); $this->run("SQL HERE"); $this->endSetup(); Remember database update change the module version in config.xml file <modules> <CompanyName_EzeePayment> <version>0.2.0</version> </CompanyName_EzeePaymente> </modules> Then create sql update file app/code/local/CompanyName/EzeePayment/sql/ezeepayment_setup/mysql4-upgrade- 0.1.0-0.2.0.php:
  8. 8. <?php $this->startSetup(); $this->run("UPDATE SQL HERE"); $this->endSetup(); Note : 1. Make sure in your system app/code/local is in include_path. 2. Dont put your module in Root Mage folder 3. Your module first letter should be capitalized (eg. EzeePayment). 4. If your module is not showing in admin congiguration section then check and config.xml file. 5. Clear your system cache. Hope above example will help you to create custom module in magento. If you face any problem in existing code or any magento related please fill free to contact or comment us. We will feel proud to help you. Ezeelive Technologies (Magento Development Company in India )has expert team in custom magento theme design, reponsive magento ecommerce portal development and magento customization india. We developed and implement custom module, extension and plugin as per project or client requirement. Written By : Ezeelive Technologies

×