I’m having a problem with my Magento storefront where customers who register with my store during checkout cannot complete the OnePageCheckout checkout process. This error is rare and hard for me to reproduce. Here are the error messages I get:
Payment Transaction Failed Reminder
Payment transaction failed. Reason: Customer email is required.Payment Transaction Failed Reminder
Payment transaction failed. Reason: This customer email already exists.
I’m pretty sure that this means the customer tried a second time, and couldn’t complete the second checkout either.
This error is strange to me for two reasons. First of all, that error should never happen at this point in checkout; since the validation on the one page checkout does not allow you to register with an email address that already exists, the second kind of error should be impossible. The validation checks also won’t let you go any further without entering an email address at all (the first kind of error). In both cases the final payment tab, which seems to be where the error is encountered, should be hidden via JavaScript.
How is it possible that a customer gets all the way to the point where they can click the Place Order button, but didn’t get screened by the validation on the registration tab?
My guess is that it could be a browser that causes the validation to not work, and lets the customer get all the way to the last bit.
When I say this error is “rare,” I mean that it happens with something like 2 out of 1000 orders.
I am pretty sure it happens when the Quote gets converted to an Order. On the Order Save event, it will try and save the customer, as part of the transaction, while also processing the payment. I don’t think the payment gateway is throwing the error, but maybe control was passed on to that class. It most likely happens just after the saveOrderAction() function is called in the OnePageController.php file. After an error gets thrown in this function, the error gets reported like this in the stack trace:
Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
This is where the “Payment Transaction Failed Reminder” email gets generated. I think that the error has to be in this part:
$this->getOnepage()->saveOrder();
How can I go about finding where in the PHP code this error occurs? How can I correct this so that I don’t lose customers who’re in the process of trying to purchase from me?
My storefront is running on Magento version 1.9.1.1.
Update: Just got another one of these. The customer record is completely missing, but there is a shipping and billing address. Very strange.
Need more Info, but my bet is this is a MySQL master/slave race condition. Had that happening before once.
The solution was to use https://launchpad.net/mysql-proxy which is Lua scriptable.
The load balancing between master and slave (beyond just read/write splitting) was better, and the issue could be solved with a small Lua script.