As many of you know I’ve been working on my own products at Never5 for some time now. I currently have 4 webshops where I sell various WordPress plugins, 3 of them run on WooCommerce. Today I found out about an issue that might be a shop-owners worst nightmare, customers that try to place an order but can’t pay.
Someone sent me this email today:
I wanted to purchase a developer license. Unfortunately the PayPal-Gateway doesn’t seem to work.
We received a confirmation email, that an account was created. I can see the purchase in my account (/my-account/) and that the payment is still pending. If I try to pay from there, I still get the following message from PayPal:
“This invoice has already been paid. For more information, please contact the merchant
Your purchase couldn’t be completed
There’s a problem with the merchant’s PayPal account. Please try again later”.
Apparently WooCommerce was creating the order, leaving it at pending and PayPal would not allow the user to pay for the order because according to them it was already paid for. After doing some research I found out that PayPal keeps track of the Invoice ID you pass to them and actually checks upon payment if an order with that Invoice ID has already been paid.
WooCommerce allows you to prefix the invoice ID, having a default prefix of
WC-. The problem I was running into is that I never changed this default prefix, for all 3 of my WooCommerce shops. So when someone purchased a Related Posts for WordPress Premium license, WooCommerce would generate a PayPal invoice ID of
ORDER_ID. As an example this would result in:
Normally this would be unique, because you can’t have 2 orders with the same ID in WooCommerce. But I have 3 WooCommerce shops, so there’s a chance that an order with the same ID was done at PayPal by one of my other shops. When this was the case PayPal would prevent the user from paying the order because a payment for the same invoice ID was already recorded.
Luckily the solution is very simple. You go to your PayPal settings in WooCommerce and make sure every store has an unique invoice prefix, in my case like this:
This was quite an annoying and hard to track down issue because it doesn’t happen all the time. WooCommerce uses WordPress’s default post ID’s so this value increments at a different rate per shop and even if multiple shops get an order with an overlapping ID they have to be paid for with the same payment provider (PayPal in this case). On top of that I was very lucky that the person running into this issue today contacted me (!!). Most people would close the tab and move on, making you lose a sale because of a misconfiguration.
Looking at my shop history there were multiple pending and failed orders that could be caused by this misconfiguration. I’m not saying they are, there are also a lot of people who just close their browser at the payment screen for various reasons.
I hope this helps you in solving (or even better, preventing) this specific issue. Losing sales because of silly things like this makes you sad