SlideShare ist ein Scribd-Unternehmen logo
1 von 8
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>
<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>
<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>
<!-- 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;
//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>
<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">
<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:
<?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

Weitere ähnliche Inhalte

Andere mochten auch

Seo proposals
Seo proposalsSeo proposals
Seo proposals
HubShout
 
Seo smo- ppc proposal- info
Seo smo- ppc proposal- infoSeo smo- ppc proposal- info
Seo smo- ppc proposal- info
sanjeevoctashop
 

Andere mochten auch (12)

Seo company in Noida
Seo company in NoidaSeo company in Noida
Seo company in Noida
 
Seo proposals
Seo proposalsSeo proposals
Seo proposals
 
Online shopping system (E-commerce)
Online shopping system (E-commerce)Online shopping system (E-commerce)
Online shopping system (E-commerce)
 
SEO proposal - free template - SEOmonitor.com
SEO proposal - free template - SEOmonitor.comSEO proposal - free template - SEOmonitor.com
SEO proposal - free template - SEOmonitor.com
 
E-Commerce Website Designing Proposal Form E solutions india
E-Commerce Website Designing Proposal Form E solutions indiaE-Commerce Website Designing Proposal Form E solutions india
E-Commerce Website Designing Proposal Form E solutions india
 
SEO Proposal Presentation
SEO Proposal PresentationSEO Proposal Presentation
SEO Proposal Presentation
 
Internet Marketing Proposal & SEO/Search Engine Rank Report
Internet Marketing Proposal & SEO/Search Engine Rank Report Internet Marketing Proposal & SEO/Search Engine Rank Report
Internet Marketing Proposal & SEO/Search Engine Rank Report
 
Seo smo- ppc proposal- info
Seo smo- ppc proposal- infoSeo smo- ppc proposal- info
Seo smo- ppc proposal- info
 
Seo ppt
Seo pptSeo ppt
Seo ppt
 
e-Commerce Website Development Proposal
e-Commerce Website Development Proposale-Commerce Website Development Proposal
e-Commerce Website Development Proposal
 
Online shopping portal: Software Project Plan
Online shopping portal: Software Project PlanOnline shopping portal: Software Project Plan
Online shopping portal: Software Project Plan
 
Social Media & SEO Proposal
Social Media & SEO ProposalSocial Media & SEO Proposal
Social Media & SEO Proposal
 

Kürzlich hochgeladen

Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
pxcywzqs
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 

Kürzlich hochgeladen (20)

Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 

Custom payment gateway module in magento

  • 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. <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. <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. <!-- 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. //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. <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. <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. <?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