Bot Blog

How to Fix PayPal “This invoice has already been paid” - Springbot

Written by Mark Konigsmark | Mar 18, 2015 4:19:55 PM

Want to know how to fix the PayPal error “This invoice has already been paid” but do not know how to get started? Michael Harper, our newest Magento Developer, has the right solution for you.
I experienced this issue after an upgrade to a client’s very dated install. We found that user’s attempting to checkout with PayPal would click to proceed to the PayPal portal after filling out their billing/shipping information and would be confronted with this error: “This invoice has already been paid”
Users who experienced this error had no alternatives or ways to resolve the problem, it was simply a PayPal gateway error. The problem originated with Magento’s internal numbering system – specifically for the eav_entity_store table. Somehow, invoice ID (entity_type_id = 6) fell way behind order ID (entity_type_id = 5). Every time Magento would send payment information to PayPal, it would send a potentially already used invoice ID to which would in turn cause the payment to get rejected completely resulting in a loss of sale for the store owner.
There are people who suggest to do the following which is only fixing the symptom and not the problem: Log into your PayPal Account (standard) -> Profile -> Payment Receiving Preferences -> Under Block accidental payments: select “No, allow multiple payments per invoice ID”
The correct way is to update your lagging invoice increment_last_id (entity_type_id = 6) to match your order increment_last_id (entity_type_id = 5) in the eav_entity_store table. See below for the very table I had to update.
Here is some additional reading on increment IDs in Magento: https://www.ashsmith.io/2012/12/quick-tip-change-magento-default-increment-id-for-orders-invoices/ – See more at: //www.magetricks.com/tricks/how-to-fix-paypal-this-invoice-has-already-been-paid-message#sthash.7AlYDUCs.dpuf

 About the Author
Michael Harper is a certified Magento Developer with a strong background in web development and database administration. Michael has worked for several reputable eCommerce and creative agencies along the way and is well acquainted with where the web came from and where it’s going. When he is not recording screencasts and working as a developer for Springbot, he can be found spending his time creatively as a photographer and musician. Michael also enjoys long walks from the office to his car – where he races home in a timely fashion while obeying most traffic laws. Want more Magento tips and tricks? Make sure to check out his website, //www.magetricks.com