Magento – Custom Payment Module not showing in checkout

ce-1.9.1.0frontendmodulepayment

I have tried Payment Module Development 5 times and tried lots of fixes available but none useful for me.

I have the same problem for shipment method; see Custom Shipping Module Not Showing on Frontend

I'm using Magento CE 1.9.1.0

C:\wamp\www\magento1\app\code\local\Magik\Paymentpro\etc\config.xml

<?xml version="1.0"?>
<config>
    <global>
        <models>
            <paymentpro>
                <class>Magik_Paymentpro_Model</class>
            </paymentpro>
        </models>

        <resources>
            <paymentpro_setup>
                <setup>
                    <module>Magik_Paymentpro</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </paymentpro_setup>
            <paymentpro_write>
                <use>core_write</use>
            </paymentpro_write>
            <paymentpro_read>
                <use>core_read</use>
            </paymentpro_read>
        </resources>
    </global>

    <default>
        <payment>
            <paymentpro>
                <active>0</active>
                <model>Paymentpro/PaymentMethod</model>
                <order_status>pending</order_status>
                <title>Cash On Delivery</title>
            </paymentpro>
        </payment>
    </default>
    <frontend>
        <routers>
            <mycheckout>
                <use>standard</use>
                <args>
                    <module>Inchoo_Mycheckout</module>
                    <frontname>customcard</frontname>
                </args>
            </mycheckout>
        </routers>
    </frontend>
</config>

C:\wamp\www\magento1\app\code\local\Magik\Paymentpro\etc\system.xml

<?xml version="1.0"?>
<config>
    <sections>
        <!-- payment tab -->
        <payment>
            <groups>
                <!-- paymentpro fieldset -->
                <paymentpro translate="label" module="paygate">
                    <!-- will have title 'Cash On Delivery' -->
                    <label>TCS Cash Payment Methods</label>
                    <!-- position between other payment methods -->
                    <sort_order>1</sort_order>
                    <!-- do not show this 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>
                        <!-- is this payment method active for the website? -->
                        <active translate="label">
                            <!-- label for the field -->
                            <label>Enabled</label>
                            <!-- input type for configuration value -->
                            <frontend_type>select</frontend_type>
                            <!-- model to take the option values from -->
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <!-- field position -->
                            <sort_order>1</sort_order>
                            <!-- do not show this field in store scope -->
                            <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</source_model>
                            <!--<source_model>adminhtml/system_config_source_order_status_new</source_model>-->
                            <!--<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>
                        <allowspecific translate="label">
                            <label>Payment from applicable countries</label>
                            <frontend_type>allowspecific</frontend_type>
                            <sort_order>50</sort_order>
                            <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </allowspecific>
                        <specificcountry translate="label">
                            <label>Payment from Specific countries</label>
                            <frontend_type>multiselect</frontend_type>
                            <sort_order>51</sort_order>
                            <source_model>adminhtml/system_config_source_country</source_model>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </specificcountry>

                        <title translate="label">
                            <label>Cash Method</label>
                            <frontend_type>multiselect</frontend_type>
                            <sort_order>2</sort_order>
                            <source_model>paymentpro/paymentmethod</source_model>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </title>
                    </fields>
                </paymentpro>
            </groups>
        </payment>
    </sections>
</config>

C:\wamp\www\magento1\app\code\local\Magik\PaymentPro\Model\PaymentMethod.php

<?php
class Magik_Paymentpro_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
{
    protected $_code                    = 'paymentpro';
    protected $_isGateway               = true;
    protected $_canAuthorize            = true;
    protected $_canCapture              = true;
    protected $_canCapturePartial       = false;
    protected $_canRefund               = true;
    protected $_canVoid                 = true;
    protected $_canUseInternal          = true;
    protected $_canUseCheckout          = true;
    protected $_canUseForMultishipping  = true;
    protected $_canSaveCc               = false;
    //protected $_formBlockType = 'payment/form_checkmo';
    //protected $_infoBlockType = 'payment/info_cod';

    /**
    * Assign data to info model instance
    *
    * @param   mixed $data
    * @return  Mage_Payment_Model_Method_Checkmo
    */

  public function toOptionArray()
  {
    return array(
      array('value' => 0, 'label' => 'Cash On Delivery'),
      array('value' => 1, 'label' => 'Cash At Doorstep')   );
  }
    public function authorize(Varien_Object $payment, $amount){
        $data = $payment->getData();
        /*
        $data = array(
        store_id,
        customer_payment_id,
        method,
        additional_data,
        po_number,
        cc_type,
        cc_number_enc,
        cc_last4,
        cc_owner,
        cc_exp_month,
        cc_exp_year,
        cc_number,
        cc_cid,
        cc_ss_issue,
        cc_ss_start_month,
        cc_ss_start_year,
        parent_id,
        amount_ordered,
        base_amount_ordered,
        shipping_amount,
        base_shipping_amount,
        method_instance)
        */
    }
    public function capture(Varien_Object $payment, $amount){
        // Grab stored payment data array for processing
        $paymentData = unserialize($payment->getAdditionalData());
    }
    public function void(Varien_Object $payment){
        // actions when order is voided occur here
    }
    public function refund(Varien_Object $payment, $amount){
        // actions when order is refunded occur here
    }   
    public function assignData($data){
        $details = array();
        if ($this->getPayableTo()) {
        $details['payable_to'] = $this->getPayableTo();
        }
        if ($this->getMailingAddress()) {
        $details['mailing_address'] = $this->getMailingAddress();
        }
        if (!empty($details)) {
        $this->getInfoInstance()->setAdditionalData(serialize($details));
        }
        return $this;
    }

    public function getPayableTo(){
        return $this->getConfigData('payable_to');
    }

    public function getMailingAddress(){
        return $this->getConfigData('mailing_address');
    }
}

C:\wamp\www\magento1\app\etc\modules\paymentpro.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <catalog_product_view>
        <reference name="product.info">
            <block type="paymentpro/catalog_product_view_profile" name="product.info.additional.recurring.schedule" as="recurring_info" template="paymentpro/catalog/product/view/profile/schedule.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Recurring Profile</value></action>
            </block>
        </reference>
        <reference name="product.info.options.wrapper">
            <block type="paymentpro/catalog_product_view_profile" name="product.info.options.recurring" as="recurring_options" template="paymentpro/catalog/product/view/profile/options.phtml"/>
        </reference>
    </catalog_product_view>
</layout>

C:\wamp\www\magento1\app\code\local\Magik\Paymentpro\etc\Magik_Paymentpro.xml

<?xml version="1.0"?>
<config>
    <modules>
        <!-- declare Magik_Paymentpro module -->
        <Magik_Paymentpro>
            <!-- this is an active module -->
            <active>true</active>
            <!-- this module will be located in app/code/local code pool -->
            <codePool>local</codePool>
            <!-- specify dependencies for correct module loading order -->
            <depends>
                <Mage_Payment />
            </depends>
            <!-- declare module's version information for database updates -->
            <version>0.1.0</version>
        </Magik_Paymentpro>
    </modules>
</config>

C:\wamp\www\magento1\app\design\frontend\base\default\template\paymentpro.phtml

<?php
// Retrieve order
$_order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
?>
<form name="paymentproform" method="post" action="http://www.gateway.com/the_url_they_gave_me">
    <input type="hidden" name="orderid" value="<?php echo $orderId; ?>">
    <input type="hidden" name="grandtotal" value="<?php echo $_order->getBaseGrandTotal(); ?>">
</form>
<script type="text/javascript">
document.paymentproform.submit();
</script>

Best Answer

<default>
    <payment>
        <paymentpro>
            <active>0</active>
            <model>Paymentpro/PaymentMethod</model>
            <order_status>pending</order_status>
            <title>Cash On Delivery</title>
        </paymentpro>
    </payment>
</default>

Should be

<default>
    <payment>
        <paymentpro>
            <!-- can be overridden via System > Config (see `core_config_data`) -->
            <active>1</active>
            <!--
                Your model class group is "paymentpro" not "Paymentpro". Also,
                "PaymentMethod" points to "Magik_Paymentpro_Model_PaymentMethod"
            -->
            <model>paymentpro/PaymentMethod</model>
            <order_status>pending</order_status>
            <title>Cash On Delivery</title>
        </paymentpro>
    </payment>
</default>
Related Topic