After tearing my hair out for weeks working on a problem where no matter what i tried every time an order was placed on a customers magento website, where paypal was the selected payment gateway the order would always automatically cancel nearly immediately after the order was placed.
The logs werent helpful, and the magento order status notes would basically just say that the order was cancelled, and the customer notified. We noticed this was only occuring for paypal customers, other payment gateways would allow the order to go through as normal.
Initially we thought it must have been a database conflict after we had reset a bunch of test orders. We even went as far as a full magento re-install to try and fix the issue. All with no fix. 🙁
Finally one afternoon, i found the answer! And boy was it frustratingly simple (as it often is)
In the end the issue was with Paypal – not magento at all!
Paypal has a feature that is enabled by default. “Block accidental payments”
What does this do? PayPal states “You may prevent accidental payments by blocking duplicate invoice IDs”
So hows this affect us you ask?
In my customers case this wasn’t the first time they had used their paypal account for accepting orders through an online store, so the security feature above was jumping in and not allowing the payment to complete, this would then send the failed hit back to magento.
All because invoices with that reference number had been previously run through Paypal (even if it was for a totally different site). To fix it we simply disabled this option as it was the best for us. You do however have a few options depending on your situation.
Your options for a fix:
- Ensure each magento store is setting a unique invoice ref number, perhaps appending it with text storeid[invoiceid]
- Use an individual Paypal account for each magento store you intend on operating.
- Disable the feature in Paypal (easiest – this is the option we opted for)
Disabling the option in Paypal
If you head into your Paypal
- Select the profile option under the My account Menu
- Select My selling tools (in the left menu)
- Select the update option on the block payments section
- Select the “No, allow multiple payments per invoice ID”
- Save the options and exit paypal.
Do you happen to know if this could be the same problem if you are using Payflow Link to submit your payment? We’ve been having some phantom Magento Cancelled orders that seem to have no explanation.
Hey, had the same problem so your article came in useful. Thanks vm. David
Bless you!! 🙂