Magento – how to add credit card details input fields in Checkout Page when creating a new payment method gateway

paymentpayment-gateway

I'm trying to create a new payment method for our Magento EE 1.12 installation. I followed this tutorial and gotten as far as making the payment method with its options appear in the admin, and also the payment method's name as an option in the Checkout page. Unfortunately, the tutorial stops there.

I was wondering what file I should create (and where to put it), so that when the user clicks on my payment method's radio button in the Checkout page, it will show textboxes for the credit card number, CVV, and dropdowns for expiry date and card type (VISA, etc). Note that this is for the Checkout page. Once I get to add these textboxes and dropdown, how do I get their values so I can process them in during the authorize() method?

Lastly, is there an official documentation from Magento about creating a new payment method module? I find the Magento documentation too overwhelming for a beginner like myself. Could you point me to some useful references, like the tutorial above, but more complete?

Best Answer

It seams that you are trying to replicate the behavior of the payment methods CC (credit card). Magento already has this. You can can look for guidance in the files used for this method:

  • app/code/core/Mage/Payment/Block/Form/Cc.php
  • app/code/core/Mage/Payment/Block/Info/Cc.php
  • app/code/core/Mage/Payment/Model/Method/Cc.php
  • app/design/frontend/base/default/template/payment/form/cc.phtml
  • app/design/adminhtml/default/default/template/payment/form/cc.phtml
  • app/code/core/Mage/Payment/etc/config.xml - look for tags named <cc>
Related Topic