Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:45:28+00:00 2026-05-30T00:45:28+00:00

I am developing a payment module. I don’t find proper documentation anywhere for Magento

  • 0

I am developing a payment module. I don’t find proper documentation anywhere for Magento System.

As of now I am facing a problem in capture method of Payment Method Model. Please help me.

I don’t know why the CURL request for REST API is not being created and sent. It executes first two or three lines only. I don’t think the way I wrote code below is right, Please suggest best way. After Placing order I “Got Info Instance” and amount in Log file as given in code. The other data for which I have called Mage::Log() doesn’t appear in System log file.

I have payment Method code like this

    <?php 
class Company_Cashondelivery_Model_Createorder extends Mage_Payment_Model_Method_Abstract
{   
    protected $_code = 'cashondelivery';
    protected $_canCapture = true;
    protected $_canUseCheckout = true;
    public function capture(Varien_Object $payment, $amount)
    {
                $paymentInfo = $this->getInfoInstance();  
                Mage::Log('Got Info Instance'); //This is shown in Log file.
                Mage::Log($amount); //This is shown in Log file
                Mage::Log($payment);                 
                    $xml='<?xml version="1.0" encoding="utf-8" ?>'.
                        '<transaction>'.
                        '<customerDetails>'.
                        '<address>This is, address, Purple Talk, 600100</address>'. //I dont know how to get Address as string here
                        '<contactNo>'.$paymentInfo->getOrder()->getBillingAddress()->getTelephone().'</contactNo>'.
                        '<email>'.$paymentInfo->getOrder()->getBillingAddress()->email().'</email>'.
                        '<firstName>'.$paymentInfo->getOrder()->getBillingAddress()->getFirstName().'</firstName>'.
                        '<lastName>'.$paymentInfo->getOrder()->getBillingAddress()->getLastName().'</lastName>'.
                        '</customerDetails>'.
                        '<orderDetails>'.
                        '<pincode>'.$paymentInfo->getOrder()->getBillingAddress()->getPostCode().'</pincode>'.
                        '<clientOrderID>'.$paymentInfo->getOrder()->getIncrementId().'</clientOrderID>'.
                        '<deliveryDate>20-7-20111</deliveryDate>'.
                        '<orderAmount>'.$amount.'</orderAmount>'.
                        '<productDetails>';
                    Mage::Log($xml);//This is not there in log file    
                    foreach ($paymentInfo->getOrder()->getAllItems() as $item) 
                        {
                            $xml.='<productDetails>'.
                            '<productID>'.$item->getProductId().'</productID>'.
                            '<productQuantity>'.$item->getQtyOrdered().'</productQuantity>'.
                            '<unitCost>'.$item->getPrice().'</unitCost>'.
                            '</productDetails>';
                        }
                       $xml.='</orderDetails>'.
                        '<additionalInformation>'.
                        '<parameters>'.
                        '<name>Some Name</name>'.
                        '<value>Some Value</value>'.
                        '</parameters>'.
                        '<parameters>'.
                        '<name>Some Name2</name>'.
                        '<value>Some value2</value>'.
                        '</parameters>'.
                        '</additionalInformation>'.
                        '</transaction>';
                        Mage::Log($xml);
                        $url = "http://services.abc.com/rest/service/createOrder";
                        Mage::Log('Loading url : '.$url); //This is not there in Log;
                        $ch = curl_init($url) ;
                        curl_setopt($ch, CURLOPT_HEADER,true);
                        curl_setopt($ch, CURLOPT_POST, true);
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
                        curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
                        curl_setopt($ch, CURLOPT_HTTPHEADER, array('username:xxxxx','password:xxxxxx','Content-Type:application/xml'));
                        $response = curl_exec($ch);
                        Mage::Log($response); //This is not there in Log file;
                   return $this;    
    }     
}
?>

The Config.xml file is like this

<?xml version="1.0"?>
<config>
    <modules>
       <Company_Cashondelivery>
<!-- declare module's version information for database updates -->
          <version>0.1.0</version>
       </Company_Cashondelivery>
    </modules>
    <global>
<!-- declare model group for new module -->
        <models>
<!-- model group alias to be used in Mage::getModel('newmodule/...') -->
            <cashondelivery>
<!-- base class name for the model group -->
                <class>Company_Cashondelivery_Model</class>
            </cashondelivery>    
        </models>
        <helpers>
            <cashondelivery>
                <class>Company_Cashondelivery_Helper</class>
            </cashondelivery>
        </helpers> 
<!-- declare resource setup for new module -->
        <resources>
<!-- resource identifier -->
            <cashondelivery_setup>
<!-- specify that this resource is a setup resource and used for upgrades -->
                <setup>
<!-- which module to look for install/upgrade files in -->
                    <module>Company_Cashondelivery</module>
                </setup>
<!-- specify database connection for this resource -->
                <connection>
<!-- do not create new connection, use predefined core setup connection -->
                    <use>core_setup</use>
                </connection>
            </cashondelivery_setup>
            <cashondelivery_write>
                <connection>
                  <use>core_write</use>
                </connection>
            </cashondelivery_write>
            <cashondelivery_read>
               <connection>
                <use>core_read</use>
              </connection>
            </cashondelivery_read>
        </resources>
    </global>

<!-- declare default configuration values for this module -->
    <default>
        <payment>
            <cashondelivery>
                <active>1</active>
                <model>cashondelivery/createorder</model>
                <order_status>pending</order_status>
                <payment_action>authorize_capture</payment_action>
                <title>Company</title>                
            </cashondelivery>
         </payment>
    </default>
</config>

The system.xml file is like this

<?xml version="1.0"?>
<config>
   <sections>
        <payment>
            <groups>
                <cashondelivery translate="label" module="cashondelivery">
                    <label>Company Cash On delivery</label>
                    <sort_order>670</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>0</show_in_store>
                    <fields>
                        <active translate="label">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>1</sort_order>
                            <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_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>
                        <title translate="label">
                            <label>Title</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </title>
                    </fields>
                </cashondelivery>
            </groups>
        </payment>
    </sections>
</config>

The etc/module/Company_Cashondelivery.xml is like this

<?xml version="1.0"?>
<config>
    <modules>
        <Company_Cashondelivery>
            <active>true</active>
            <codePool>local</codePool>
         </Company_Cashondelivery>
    </modules>
    <depends> 
        <Mage_Payment /> 
    </depends> 
</config>

Let me know If I am not clear with anything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:45:31+00:00Added an answer on May 30, 2026 at 12:45 am

    The problem was Mag::Log($payment) I removed it and its working like a magic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a payment Module for Magento. I did this using this tutorial
I am developing a payment method module in Magento. When I click payment methods
I'm currently developing a payment module, which is already working fine, even managed to
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.
So I am developing one application on Android with multiple features. Now I am
Developing search utility to search a file entire computer system, works fine on windows
Developing a desktop application based on Java + Swing I faced the problem of
NOTE: I'm developing for Mac, not iOS! - (void)recordTransaction:(SKPaymentTransaction *)transaction { if ([transaction.payment.productIdentifier isEqualToString:kInAppProIdentifier])
I am developing an e-commerce website, I want payment process to be done from
I'm developing an Android app and publishing it in Google Market. The problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.