Magento Customization India – Custom Payment Gateway Module in Magento

Back to Blog
magento ecommerce developers mumbai - ezeelive

Magento Customization India – Custom Payment Gateway Module in Magento

Payment Gateway is the 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 does:

A. valid and accept credit card detail
B. authorize payment detail when submitting order detail
C. Save Transaction ID along with user detail in Order

So let’s 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 declared:

<Mage_Payment />

2. Create xml file app/code/local/CompanyName/EzeePayment/etc/config.xml for module configuration:

<?xml version="1.0"?>
<!-- model for ezeepayment module -->
<!-- setup for ezeepayment module -->
<!-- identifier -->
<!-- default configuration values for this module -->
<!-- 'payment' configuration section -->
<!-- 'ezeepayment' configuration group -->
<!-- by default this payment method is inactive -->
<!-- model to handle logic for this payment method -->
<!-- order status for new orders paid by this payment method -->
<!-- default title for payment checkout page and order view page -->
<title>Credit Card (</title>


3. Now create EzeePayment Model PHP file in app/code/local/CompanyName/EzeePayment/Model/PaymentMethod.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"?>
<!-- payment tab -->
<!-- ezeepayment fieldset -->
<ezeepayment translate="label" module="paygate">
<!-- For title 'Ezee Payment' -->
<label>Ezee Payment</label>
<!-- not to show configuration options in store scope -->
<!-- active for website? -->
<active translate="label">
<order_status translate="label">
<label>New order status</label>
<title translate="label">

5. Create SQL Installer file app/code/local/CompanyName/EzeePayment/sql/ezeepayment_setup/mysql4-install-0.1.0.php:

$this->run("SQL HERE");

Remember database update change the module version in config.xml file


Then create SQL update file app/code/local/CompanyName/EzeePayment/sql/ezeepayment_setup/mysql4-upgrade-0.1.0-0.2.0.php:

$this->run("UPDATE SQL HERE");

Note :
1. Make sure in your system app/code/local is in include_path.
2. Don’t 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 configuration section then check and config.xml file.
5. Clear your system cache.

Hope above example will help you to create the custom module in Magento. If you face any problem with existing code or any Magento related please fill free to contact or comment us. We will feel proud to help you.

In the Last Word :

Ezeelive Technologies (Magento Development Company in India) has the expert team in custom Magento theme design, responsive Magento e-commerce portal development, and Magento customization India. We developed and implement the custom module, extension, and plugin as per project or client requirement.

Magento Customization India - Custom Payment Gateway Module in Magento
Article Name
Magento Customization India - Custom Payment Gateway Module in Magento
Ezeelive experts in responsive magento website design, modules, templates, extensions and plugin, magento customization india, ecommerce portal development.
Publisher Name
Ezeelive Technologies
Publisher Logo

Share this post

Comment (1)

  • Avatar
    Millar Reply

    Great site you’ve got here.. It’s difficult to find excellent writing like yours nowadays. I truly appreciate people like you! Take care!!

    August 31, 2014 at 12:01 am

Leave a 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.

Back to Blog