I am trying to create a custom payment module in magento. I found a lot of tutorials for this, but only ones that just add the order. My question is: How can i set the order to paid when the user clicks on checkout.
This is the relevant code i have so far:
Config.xml
<?xml version="1.0"?>
<config>
<modules>
<My_Module>
<version>1.0.0.0</version>
</My_Module>
</modules>
<global>
<models>
<My_Module>
<class>My_Module_Model</class>
</My_Module>
</models>
</global>
<default>
<payment>
<mypayment>
<active>1</active>
<model>My_Module/Payment</model>
<order_status>processing</order_status>
<title>Testing</title>
</mypayment>
</payment>
</default>
</config>
Model/payment.php
<?php
class My_Module_Model_Payment extends Mage_Payment_model_Method_Abstract{
protected $_code = 'mypayment';
protected $_isInitializeNeeded = false;
protected $_canUseInternal = true;
protected $_canUseForMultishipping = true;
}
I also find it very hard to find documentation. For example, i am looking for a list of events, and a documentation for the payment method, but i do not seem to find anything. Does Magento not offer any of these?
I think you need to utilize the Varien_Object and Sales_Quote to do any custom payment of any sorts with Magento (not sure on this), and not just the abstract payment method.
Check this (the answer has a link to an actual working example of a custom payment module). Magento custom payment method