Php – magento: “there was an error processing your order” when trying to place an order with authorize.net

magentomagento-1.7PHP

I have recently upgraded my magento system from 1.4.0.1 to 1.7.0.2.

Error

"there was an error processing your order"

I setup the payment methods with no problem, but when I tried using the authorize.net option I get a popup message saying "there was an error processing your order". The order doesn't show in the backend but the payments are processed and I get a confirmation email with my order number.

I checked with authorize.net to see if the payment has passed and the credit card is valid and there seems to be no problem with them and it took out the option that the problem might be because of bad configuration.

Edit:

found this in the log:

2013-06-22T21:45:48+00:00 ERR (3):
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY'' in /home/bellater/public_html/lib/Zend/Db/Statement/Pdo.php:228

Stack trace:
#0 /home/bellater/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/bellater/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/bellater/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/bellater/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/bellater/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO lo...', Array)
\#5 /home/bellater/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO
lo…', Array)
#6 /home/bellater/public_html/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo…', Array)
#7 /home/bellater/public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(261): Zend_Db_Adapter_Abstract->insert('log_quote', Array)
#8 /home/bellater/public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(116): Mage_Log_Model_Resource_Visitor->_saveQuoteInfo(Object(Mage_Log_Model_Visitor))
#9 /home/bellater/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Mage_Log_Model_Visitor))
#10 /home/bellater/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#11 /home/bellater/public_html/app/code/core/Mage/Log/Model/Visitor.php(189): Mage_Core_Model_Abstract->save()
#12 /home/bellater/public_html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->saveByRequest(Object(Varien_Event_Observer))
#13 /home/bellater/public_html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'saveByRequest', Object(Varien_Event_Observer))
#14 /home/bellater/public_html/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_acti…', Array)
#15 /home/bellater/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(552): Mage::dispatchEvent('controller_acti…', Array)
#16 /home/bellater/public_html/app/code/core/Mage/Core/Controller/Front/Action.php(75): Mage_Core_Controller_Varien_Action->postDispatch()
#17 /home/bellater/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(423): Mage_Core_Controller_Front_Action->postDispatch()
#18 /home/bellater/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('add')
#19 /home/bellater/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))
#20 /home/bellater/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#21 /home/bellater/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#22 /home/bellater/public_html/index.php(87): Mage::run('', 'store')
#23 {main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY'' in /home/bellater/public_html/lib/Zend/Db/Statement/Pdo.php:234

Stack trace:
#0 /home/bellater/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/bellater/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/bellater/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/bellater/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO lo...', Array)
\#4 /home/bellater/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO
lo…', Array)
#5 /home/bellater/public_html/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo…', Array)
#6 /home/bellater/public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(261): Zend_Db_Adapter_Abstract->insert('log_quote', Array)
#7 /home/bellater/public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(116): Mage_Log_Model_Resource_Visitor->_saveQuoteInfo(Object(Mage_Log_Model_Visitor))
#8 /home/bellater/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Mage_Log_Model_Visitor))
#9 /home/bellater/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#10 /home/bellater/public_html/app/code/core/Mage/Log/Model/Visitor.php(189): Mage_Core_Model_Abstract->save()
#11 /home/bellater/public_html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->saveByRequest(Object(Varien_Event_Observer))
#12 /home/bellater/public_html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'saveByRequest', Object(Varien_Event_Observer))
#13 /home/bellater/public_html/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_acti…', Array)
#14 /home/bellater/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(552): Mage::dispatchEvent('controller_acti…', Array)
#15 /home/bellater/public_html/app/code/core/Mage/Core/Controller/Front/Action.php(75): Mage_Core_Controller_Varien_Action->postDispatch()
#16 /home/bellater/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(423): Mage_Core_Controller_Front_Action->postDispatch()
#17 /home/bellater/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('add')
#18 /home/bellater/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))
#19 /home/bellater/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /home/bellater/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#21 /home/bellater/public_html/index.php(87): Mage::run('', 'store')
#22 {main}

What could be the problem?

Best Answer

It means there was a Magento or PHP error after the payment API request was sent, but before the order could be created in your Magento system. There's three places in Magento's codebase where that wording is used for an exception.

app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php
94:            $result['error_msg'] = $this->__('There was an error processing your order. Please contact us or try again later.');

catch (Exception $e) {
    Mage::logException($e);
    $result['success'] = 0;
    $result['error_msg'] = $this->__('There was an error processing your order. Please contact us or try again later.');
}

app/code/core/Mage/Checkout/controllers/OnepageController.php
553:            $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');

} catch (Exception $e) {
    Mage::logException($e);
    Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
    $result['success']  = false;
    $result['error']    = true;
    $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
}    

app/code/core/Mage/Paypal/Model/Api/Nvp.php
987:            Mage::throwException(Mage::helper('paypal')->__('There was an error processing your order. Please contact us or try again later.'));

if (!$this->_validateResponse($methodName, $response)) {
    Mage::logException(new Exception(
        Mage::helper('paypal')->__("PayPal response hasn't required fields.")
    ));
    Mage::throwException(Mage::helper('paypal')->__('There was an error processing your order. Please contact us or try again later.'));
}

As you can see, in each case Magento will log the exception before re-throwing it. This means an error will be logged to your var/log/exception.log (assuming you have logging on). If turning on logging is too much for you, you could add temporary debugging code. Something like

var_dump($e->getMessage());
exit;

in the exception blocks. (Since this isn't PayPal related, I'm guessing that third use of the error message isn't the one you're seeing).

When Magento code catches a non-Magento exception, it typically uses a generic error message to hide (possibly sensitive) PHP system information from end users.

Related Topic