This article provides a fix for the PayPal gateway rejected request - duplicate invoice issue.
When submitting payment, Customers may see an error for a duplicate invoice:
PayPal gateway has rejected request. Payment has already been made for this InvoiceID (#10412: Duplicate invoice)
The issue occurs when invoices with the same IDs are sent to PayPal several times.
To resolve the problem, allow multiple payments per invoice ID in PayPal’s Payment Receiving Preferences. When changed, PayPal accepts payments with no error messages, even for invoices with duplicate IDs.
When submitting payment, customers see the error message:
... main.CRITICAL: Exception message: PayPal gateway has rejected request. Payment has already been made for this InvoiceID (#10412: Duplicate invoice).
PayPal cannot process the payment and complete the order.
The error message is displayed when invoices with the same ID are submitted to PayPal multiple times.
This may happen when using the same credentials across several Adobe Commerce sites (even across the Local and the Staging environments). Particular scenarios might be the following:
By default, PayPal does not allow processing for the same invoice twice.
Change your PayPal profile to allow for multiple payments per invoice ID. You need to make these changes through PayPal.