Sei sulla pagina 1di 8

Custom Payment Gateway Module in Magento

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 Framewor Module structure. !ere developer can developed modules and e"tensions as per there re#uirement and use or re$use. % payment gateway system mostly do & %. valid and accept credit card detail '. autherise payment detail when submit order detail C. Save (ransaction )* along with user detail in +rder So lets create a Custom Payment Gateway Module in Magento in below steps, here our module name is -.eePayment & 1. Create "ml file in app/etc/modules/Company0ame1-.eePayment."ml for Module declarate&
2config3 2modules3 2Company0ame1-.eePayment3 2active3true2/active3 2codePool3local2/codePool3 2depends3

2Mage1Payment /3 2/depends3 2/Company0ame1-.eePayment3 2/modules3 2/config3

2. Create "ml file app/code/local/Company0ame/-.eePayment/etc/config."ml for module configuration&


24"ml version567.8643 2config3 2modules3 2Company0ame1-.eePayment3 2version38.7.82/version3 2/Company0ame1-.eePayment3 2/modules3 2global3 2bloc s3 2e.eepayment3 2class3Company0ame1-.eePayment1'loc 2/class3 2/e.eepayment3 2/bloc s3 29$$ model for e.eepayment module $$3 2models3 2e.eepayment3 2class3Company0ame1-.eePayment1Model2/class3 2/e.eepayment3 2/models3 29$$ setup for e.eepayment module $$3 2resources3 29$$ identifier $$3 2e.eepayment1setup3 2setup3 2module3Company0ame1-.eePayment2/module3

2/setup3 2connection3 2use3core1setup2/use3 2/connection3 2/e.eepayment1setup3 2e.eepayment1write3 2connection3 2use3core1write2/use3 2/connection3 2/e.eepayment1write3 2e.eepayment1read3 2connection3 2use3core1read2/use3 2/connection3 2/e.eepayment1read3 2/resources3 2/global3 29$$ default configuration values for this module $$3 2default3 29$$ :payment: configuration section $$3 2payment3 29$$ :e.eepayment: configuration group $$3 2e.eepayment3 29$$ by default this payment method is inactive $$3 2active382/active3 29$$ model to handle logic for this payment method $$3 2model3e.eepayment/paymentMethod2/model3 29$$ order status for new orders paid by this payment method $$3 2order1status3pending2/order1status3 29$$ default title for payment chec out page and order view page $$3 2title3Credit Card ;%uthori.e.net<2/title3

2cctypes3%-,=),MC,*)2/cctypes3

2payment1action3authori.e2/payment1action3 2allowspecific382/allowspecific3 2/e.eepayment3 2/payment3 2/default3 2/config3

3. 0ow create -.eePayment Model php file in app/code/local/Company0ame/-.eePayment/Model/PaymentMethod.php &


24php class Company0ame1-.eePayment1Model1PaymentMethod e"tends Mage1Payment1Model1Method1Cc > protected ?1code 5 :e.eepayment:@ //payment method ;online auth/charge< 4 protected ?1isGateway 5 true@

//authori.e online4 protected ?1can%uthori.e 5 true@

//capture funds online4 protected ?1canCapture 5 true@

//capture partial amounts online4 protected ?1canCapturePartial 5 false@

//Can refund online4 protected ?1canAefund 5 false@

//Can void transactions online4 protected ?1can=oid 5 true@

//Can use payment method internal in admin panel4 protected ?1canBse)nternal 5 true@

//Can show payment method as an option on chec out payment page4 protected ?1canBseChec out 5 true@

//)s this payment method for multiple shipping chec out4 protected ?1canBseForMultishipping 5 true@

//Save credit card detail for future processing4 protected ?1canSaveCc 5 false@

//!ere you will need to code for authori.e, capture and void public methods payment gateway C 43

)n this above class now we have to do actual code for communicating payment gateway. )f in admin panel you have selected D%uthori.e +nlyE, then authori.e method will be called. )f you have chosen D%uthori.e and Capture then only the capture method will be called 4. 0ow create system "ml file app/code/local/Company0ame/-.eePayment/etc/system."ml for *eclare configuration options in magento admin panel &
24"ml version567.8643 2config3 2sections3 29$$ payment tab $$3 2payment3 2groups3 29$$ e.eepayment fieldset $$3 2e.eepayment translate56label6 module56paygate63 29$$ For title :-.ee Payment: $$3 2label3-.ee Payment2/label3 2sort1order3FG82/sort1order3 29$$ not to show configuration options in store scope $$3

2show1in1default372/show1in1default3 2show1in1website372/show1in1website3 2show1in1store382/show1in1store3 2fields3 29$$ active for website4 $$3 2active translate56label63 2label3-nabled2/label3 2frontend1type3select2/frontend1type3 2source1model3adminhtml/system1config1source1yesno2/source1model3 2sort1order372/sort1order3 2show1in1default372/show1in1default3 2show1in1website372/show1in1website3 2show1in1store382/show1in1store3 2/active3 2order1status translate56label63 2label30ew order status2/label3 2frontend1type3select2/frontend1type3 2source1model3adminhtml/system1config1source1order1status1processing2/source1model3 2sort1order3H2/sort1order3 2show1in1default372/show1in1default3 2show1in1website372/show1in1website3 2show1in1store382/show1in1store3 2/order1status3 2title translate56label63 2label3(itle2/label3 2frontend1type3te"t2/frontend1type3 2sort1order3I2/sort1order3 2show1in1default372/show1in1default3 2show1in1website372/show1in1website3 2show1in1store382/show1in1store3 2/title3 2/fields3 2/e.eepayment3

2/groups3 2/payment3 2/sections3 2/config3

5. Create SJK )nstaller file app/code/local/Company0ame/-.eePayment/s#l/e.eepayment1setup/mys#lH$ install$8.7.8.php&


24php ?this$3startSetup;<@ ?this$3run;6SJK !-A-6<@ ?this$3endSetup;<@

Aemember database update change the module version in config."ml file


2modules3 2Company0ame1-.eePayment3 2version38.I.82/version3 2/Company0ame1-.eePaymente3 2/modules3

(hen create s#l update file app/code/local/Company0ame/-.eePayment/s#l/e.eepayment1setup/mys#lH$ upgrade$8.7.8$8.I.8.php&


24php ?this$3startSetup;<@ ?this$3run;6BP*%(- SJK !-A-6<@ ?this$3endSetup;<@

Note : 7. Ma e sure in your system app/code/local is in include1path. I. *ont put your module in Aoot Mage folder L. Mour module first letter should be capitali.ed ;eg. -.eePayment<. H. )f your module is not showing in admin congiguration section then chec and config."ml file. N. Clear your system cache.

!ope above e"ample will help you to create custom module in magento. )f you face any problem in e"isting code or any magento related please fill free to contact or comment us. We will feel proud to help you. Ezeelive Technologies ;Magento *evelopment Company in )ndia <has e"pert team in custom magento theme design, reponsive magento ecommerce portal development and magento customization india. We developed and implement custom module, e"tension and plugin as per proOect or client re#uirement. Written 'y & -.eelive (echnologies

Potrebbero piacerti anche