Article

Magento error fix: "Cannot retrieve payment method instance"

Thinking about upgrading and optimizing Magento? Think again if you have plenty of extensions installed and later on, you want to get rid of some of them, especially when they are payment methods.

I don't know if it's Magento's fault or some extensions are poorly written, but believe me, some errors can drive you nuts when you don't know where to start debugging.

If you have orders where customers used a certain payment gateway or method and you disable this payment method later, you are left without any possibility to view those orders in the backend anymore. Yeah, start learning some phpMyAdmin...

If you take a look at the error logs in the /var/report folder and you see something like this, then you have a problem which can involve some database research.

a:5:{i:0;s:40:"Cannot retrieve payment method instance.";i:1;s:5262:"#0 /home/xxx/public_html/app/code/core/Mage/Payment/Model/Info.php(83): Mage::throwException('Cannot retrieve...')
#1 /home/xxx/public_html/app/code/core/Mage/Payment/Helper/Data.php(119): Mage_Payment_Model_Info->getMethodInstance()
#2 /home/xxx/public_html/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php(50): Mage_Payment_Helper_Data->getInfoBlock(Object(Mage_Sales_Model_Order_Payment))
#3 /home/xxx/public_html/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php(44): Mage_Adminhtml_Block_Sales_Order_Payment->setPayment(Object(Mage_Sales_Model_Order_Payment))
#4 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(862): Mage_Adminhtml_Block_Sales_Order_Payment->_beforeToHtml()
#5 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#6 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('order_payment', true)
#7 /home/xxx/public_html/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php(112): Mage_Core_Block_Abstract->getChildHtml('order_payment')
#8 /home/xxx/public_html/app/design/adminhtml/default/default/template/sales/order/view/tab/info.phtml(45): Mage_Adminhtml_Block_Sales_Order_View_Tab_Info->getPaymentHtml()
#9 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/xxx/...')
#10 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#11 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#12 /home/xxx/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#13 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#14 /home/xxx/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php(303): Mage_Core_Block_Abstract->toHtml()
#15 /home/xxx/public_html/app/design/adminhtml/default/default/template/widget/tabs.phtml(38): Mage_Adminhtml_Block_Widget_Tabs->getTabContent(Object(Mage_Adminhtml_Block_Sales_Order_View_Tab_Info))
#16 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/xxx/...')
#17 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#18 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#19 /home/xxx/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#20 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#21 /home/xxx/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#22 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#23 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#24 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#25 /home/xxx/public_html/app/design/adminhtml/default/default/template/page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left')
#26 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/xxx/...')
#27 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#28 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#29 /home/xxx/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#30 /home/xxx/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#31 /home/xxx/public_html/app/code/core/Mage/Core/Model/Layout.php(529): Mage_Core_Block_Abstract->toHtml()
#32 /home/xxx/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(391): Mage_Core_Model_Layout->getOutput()
#33 /home/xxx/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(119): Mage_Core_Controller_Varien_Action->renderLayout()
#34 /home/xxx/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Adminhtml_Sales_OrderController->viewAction()
#35 /home/xxx/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#36 /home/xxx/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#37 /home/xxx/public_html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Controller_Varien_Front->dispatch()
#38 /home/xxx/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#39 /home/xxx/public_html/index.php(92): Mage::run('default', 'store')
#40 {main}";s:3:"url";s:50:"/index.php/vanzari/sales_order/view/order_id/3108/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}

Now, the next step is to go to phpMyAdmin, open database table sales_flat_quote_payment and look at method records to see what payment methods have been used. Now that you know the internal name (eg. cashondelivery), you know what to reactivate or reinstall.

Hopefully this will fix your nightmare!

However, if my method didn't work for you, try to post a comment, maybe I can help.

Rate this article: 

No votes yet

Comments

Is the only fix to reinstall the old module? I tried deactivating it in core_config_data, didn't help.

We switched from payment service provider, so we don't want to activate the old one again.
Is there another way to avoid this problem?

Now we can't open old orders who where payed with the old payment service provider.

Hope you have some more pointers on what to do. Thanks

I am not sure about this, but try to rename the old payment internal name into the new one in sales_flat_quote_payment table. If it still doesn't work you can revert anytime. Please post a comment after you've done this.

How to reactivate or reinstall eg. cashondelivery?

Zinat, that can be done in Extensions Manager.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
 

Portfolio

Samples of work done for me or my customers, for free or not, like websites, repairs, photography etc.
View all my recent work

 

Tutorials

I'm giving away some knowledge in my areas of expertise. Did you like something here? Share it please!
View all tutorials

 

Snippets

Useful Linux commands or other code snippets I often use.
View my useful shortcuts

 

Resources

Few bookmarks I find useful. Do you want website here? Give me a good reason and I can help you.
View my favourite web resources

About me

Hi there! My name is Marius Cârneală.

About me?

Loving husband, dad of one two three, drone pilot, web designer and administrator, SEO specialist, IT support guy, electronic hobbyist and content writer. This list is open.