In my exception.log I have a lot of this error.
It seems that Magento is giving the same orderId and invoiceId more than once, so Paypal refuse to get payment for order that are payed yet.
The same problem is for invoice number: when Paypal, via IPN, tries to communicate to Magento that the payment is done and valid Magento sometimes fails to save the invoice because the id is used yet.
In my Magento I use Aitoc Custom Order Number Pro and the problem run out when we update from CE1.7 to CE1.9.
The problem appears for about 20% of transactions (all paypal transaction) and the site is hosted on Amazon: RDS + Elasticache (Redis) + 3/4 EC2 (so we have not resource problems)
We try to get support by Aitoc but they say that is not a plugin problem... could it be a problem with Paypal module?
We also notice that our script to create invoice for some other orders, are slower than before.
Any suggestion?
Under you can find some extract from my exception.log
2016-02-02T11:34:59+00:00 ERR (3): exception 'Mage_Core_Exception' with message 'PayPal NVP gateway errors: Payment has already been made for this InvoiceID (#10412: Duplicate invoice). Correlation ID: 8e41b25d53d43. Version: 72.0.' in /home/stockisti/www/app/code/core/Mage/Paypal/Model/Api/Nvp.php:1062 Stack trace: #0 /home/example/www/app/code/core/Mage/Paypal/Model/Api/Nvp.php(1008): Mage_Paypal_Model_Api_Nvp->_handleCallErrors(Array) #1 /home/example/www/app/code/core/Mage/Paypal/Model/Api/Nvp.php(616): Mage_Paypal_Model_Api_Nvp->call('SetExpressCheck...', Array) #2 /home/example/www/app/code/core/Mage/Paypal/Model/Express/Checkout.php(381): Mage_Paypal_Model_Api_Nvp->callSetExpressCheckout() #3 /home/example/www/app/code/core/Mage/Paypal/Controller/Express/Abstract.php(108): Mage_Paypal_Model_Express_Checkout->start('https://www.sto...', 'https://www.sto...', true) #4 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Paypal_Controller_Express_Abstract->startAction() #5 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('start') #6 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #7 /home/example/www/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch() #8 /home/example/www/app/Mage.php(684): Mage_Core_Model_App->run(Array) #9 /home/example/www/it/index.php(83): Mage::run('', 'store') #10 {main}
2016-02-02T11:36:02+00:00 ERR (3): exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'F2016-01025059' for key 'UNQ_SALES_FLAT_INVOICE_INCREMENT_ID'' in /home/example/www/lib/Zend/Db/Statement/Pdo.php:228 Stack trace: #0 /home/example/www/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array) #1 /home/example/www/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) #2 /home/example/www/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array) #3 /home/example/www/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array) #4 /home/example/www/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array) #5 /home/example/www/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array) #6 /home/example/www/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array) #7 /home/example/www/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_invo...', Array) #8 /home/example/www/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php(425): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Order_Invoice)) #9 /home/example/www/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Resource_Order_Abstract->save(Object(Mage_Sales_Model_Order_Invoice)) #10 /home/example/www/app/code/core/Mage/Sales/Model/Order.php(2228): Mage_Core_Model_Abstract->save() #11 /home/example/www/app/code/core/Mage/Core/Model/Abstract.php(319): Mage_Sales_Model_Order->_afterSave() #12 [internal function]: Mage_Core_Model_Abstract->save() #13 /home/example/www/app/code/core/Mage/Core/Model/Resource/Transaction.php(105): call_user_func(Array) #14 /home/example/www/app/code/core/Mage/Core/Model/Resource/Transaction.php(159): Mage_Core_Model_Resource_Transaction->_runCallbacks() #15 /home/example/www/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save() #16 /home/example/www/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder() #17 /home/example/www/app/code/core/Mage/Paypal/Model/Express/Checkout.php(599): Mage_Sales_Model_Service_Quote->submitAll() #18 /home/example/www/app/code/core/Mage/Paypal/Controller/Express/Abstract.php(320): Mage_Paypal_Model_Express_Checkout->place('EC-7TX13358AG44...') #19 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Paypal_Controller_Express_Abstract->placeOrderAction() #20 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('placeOrder') #21 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #22 /home/example/www/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch() #23 /home/example/www/app/Mage.php(684): Mage_Core_Model_App->run(Array) #24 /home/example/www/it/index.php(83): Mage::run('', 'store') #25 {main} Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'F2016-01025059' for key 'UNQ_SALES_FLAT_INVOICE_INCREMENT_ID', query was: INSERT INTO `sales_flat_invoice` (`store_id`, `base_grand_total`, `shipping_tax_amount`, `tax_amount`, `base_tax_amount`, `store_to_order_rate`, `base_shipping_tax_amount`, `base_discount_amount`, `base_to_order_rate`, `grand_total`, `shipping_amount`, `subtotal_incl_tax`, `base_subtotal_incl_tax`, `store_to_base_rate`, `base_shipping_amount`, `total_qty`, `base_to_global_rate`, `subtotal`, `base_subtotal`, `discount_amount`, `billing_address_id`, `order_id`, `state`, `shipping_address_id`, `store_currency_code`, `transaction_id`, `order_currency_code`, `base_currency_code`, `global_currency_code`, `increment_id`, `created_at`, `updated_at`, `hidden_tax_amount`, `base_hidden_tax_amount`, `shipping_hidden_tax_amount`, `discount_description`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '2016-02-02 11:36:02', '2016-02-02 11:36:02', ?, ?, ?, ?)' in /home/example/www/lib/Zend/Db/Statement/Pdo.php:235 Stack trace: #0 /home/example/www/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) #1 /home/example/www/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array) #2 /home/example/www/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array) #3 /home/example/www/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array) #4 /home/example/www/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array) #5 /home/example/www/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array) #6 /home/example/www/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_invo...', Array) #7 /home/example/www/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php(425): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Order_Invoice)) #8 /home/example/www/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Resource_Order_Abstract->save(Object(Mage_Sales_Model_Order_Invoice)) #9 /home/example/www/app/code/core/Mage/Sales/Model/Order.php(2228): Mage_Core_Model_Abstract->save() #10 /home/example/www/app/code/core/Mage/Core/Model/Abstract.php(319): Mage_Sales_Model_Order->_afterSave() #11 [internal function]: Mage_Core_Model_Abstract->save() #12 /home/example/www/app/code/core/Mage/Core/Model/Resource/Transaction.php(105): call_user_func(Array) #13 /home/example/www/app/code/core/Mage/Core/Model/Resource/Transaction.php(159): Mage_Core_Model_Resource_Transaction->_runCallbacks() #14 /home/example/www/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save() #15 /home/example/www/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder() #16 /home/example/www/app/code/core/Mage/Paypal/Model/Express/Checkout.php(599): Mage_Sales_Model_Service_Quote->submitAll() #17 /home/example/www/app/code/core/Mage/Paypal/Controller/Express/Abstract.php(320): Mage_Paypal_Model_Express_Checkout->place('EC-7TX13358AG44...') #18 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Paypal_Controller_Express_Abstract->placeOrderAction() #19 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('placeOrder') #20 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #21 /home/example/www/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch() #22 /home/example/www/app/Mage.php(684): Mage_Core_Model_App->run(Array) #23 /home/example/www/it/index.php(83): Mage::run('', 'store') #24 {main}
2016-02-02T11:36:42+00:00 ERR (3): exception 'Mage_Core_Exception' with message 'PayPal NVP gateway errors: A successful transaction has already been completed for this token (#10415: Transaction refused because of an invalid argument. See additional error messages for details). Correlation ID: b606cfa375a29. Version: 72.0.' in /home/example/www/app/code/core/Mage/Paypal/Model/Api/Nvp.php:1062 Stack trace: #0 /home/example/www/app/code/core/Mage/Paypal/Model/Api/Nvp.php(1008): Mage_Paypal_Model_Api_Nvp->_handleCallErrors(Array) #1 /home/example/www/app/code/core/Mage/Paypal/Model/Api/Nvp.php(643): Mage_Paypal_Model_Api_Nvp->call('DoExpressChecko...', Array) #2 /home/example/www/app/code/core/Mage/Paypal/Model/Express.php(581): Mage_Paypal_Model_Api_Nvp->callDoExpressCheckoutPayment() #3 /home/example/www/app/code/core/Mage/Paypal/Model/Express.php(377): Mage_Paypal_Model_Express->_placeOrder(Object(Mage_Sales_Model_Order_Payment), '359') #4 /home/example/www/app/code/core/Mage/Sales/Model/Order/Payment.php(443): Mage_Paypal_Model_Express->capture(Object(Mage_Sales_Model_Order_Payment), '359') #5 /home/example/www/app/code/core/Mage/Sales/Model/Order/Invoice.php(395): Mage_Sales_Model_Order_Payment->capture(Object(Mage_Sales_Model_Order_Invoice)) #6 /home/example/www/app/code/core/Mage/Sales/Model/Order/Payment.php(608): Mage_Sales_Model_Order_Invoice->capture() #7 /home/example/www/app/code/core/Mage/Sales/Model/Order/Payment.php(410): Mage_Sales_Model_Order_Payment->_invoice() #8 /home/example/www/app/code/core/Mage/Sales/Model/Order/Payment.php(348): Mage_Sales_Model_Order_Payment->capture(NULL) #9 /home/example/www/app/code/core/Mage/Sales/Model/Order.php(898): Mage_Sales_Model_Order_Payment->place() #10 /home/example/www/app/code/core/Mage/Sales/Model/Order.php(1116): Mage_Sales_Model_Order->_placePayment() #11 [internal function]: Mage_Sales_Model_Order->place() #12 /home/example/www/app/code/core/Mage/Core/Model/Resource/Transaction.php(105): call_user_func(Array) #13 /home/example/www/app/code/core/Mage/Core/Model/Resource/Transaction.php(159): Mage_Core_Model_Resource_Transaction->_runCallbacks() #14 /home/example/www/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save() #15 /home/example/www/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder() #16 /home/example/www/app/code/core/Mage/Paypal/Model/Express/Checkout.php(599): Mage_Sales_Model_Service_Quote->submitAll() #17 /home/example/www/app/code/core/Mage/Paypal/Controller/Express/Abstract.php(320): Mage_Paypal_Model_Express_Checkout->place('EC-7TX13358AG44...') #18 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Paypal_Controller_Express_Abstract->placeOrderAction() #19 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('placeOrder') #20 /home/example/www/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #21 /home/example/www/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch() #22 /home/example/www/app/Mage.php(684): Mage_Core_Model_App->run(Array) #23 /home/example/www/it/index.php(83): Mage::run('', 'store') #24 {main}example
Hello,
I am also getting this same issue from my magento store! Have you solved this issue ? or How did you fixed this problem ?
Thanks,
Hi, I "solved" modifying the Aitoc Custom Order Number Pro Module.
It's new logic has concurrency problems, so it assign the same Order ID (and invoice ID) multiple times.
I add an exception catch for duplicated id and i ask for a new id.
So, my problem was the Aitoc Module. do you have it?
s.
Hello,
We don't have this module or any other related to the order id. then why i am getting this issue? Do you have any idea ?
Thanks,