Add a Product to the cart.
3.Try checking out using Paypal
You should be able to checkout
Error message appears: "PayPal gateway has rejected request. Payment has already been made for this invoiceID (#10412: Duplicate invoice)".

sales_order (state, status, protect_code, shipping_description, is_virtual, store_id, customer_id, base_discount_amount, base_grand_total, base_shipping_amount, base_shipping_tax_amount, base_subtotal, base_tax_amount, base_to_global_rate, base_to_order_rate, discount_amount, grand_total, shipping_amount, shipping_tax_amount, store_to_base_rate, store_to_order_rate, subtotal, tax_amount, total_qty_ordered, customer_is_guest, customer_note_notify, customer_group_id, quote_id, base_shipping_discount_amount, base_subtotal_incl_tax, base_total_due, shipping_discount_amount, subtotal_incl_tax, total_due, weight, increment_id, applied_rule_ids, base_currency_code, customer_email, customer_firstname, customer_lastname, customer_middlename, discount_description, global_currency_code, order_currency_code, remote_ip, shipping_method, store_currency_code, store_name, total_item_count, discount_tax_compensation_amount, base_discount_tax_compensation_amount, shipping_discount_tax_compensation_amount, base_shipping_discount_tax_compensation_amnt, discount_tax_compensation_invoiced, base_discount_tax_compensation_invoiced, discount_tax_compensation_refunded, base_discount_tax_compensation_refunded, shipping_incl_tax, base_shipping_incl_tax, gift_message_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' in /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/lib/internal/Magento/Framework/Webapi/ErrorProcessor.ph...[] []}}

Hi @SidneyBilliet
This can be resolved by setting "No, allow multiple payments per invoice ID" option in your PayPal account.
Hi @SidneyBilliet
Is this issue still reproducible after adjusting PayPal account settings?
@alena-marchenko , Hi Alena, the problem was fixed after adjsuting the paypal setting. However we would like to understand why Magento sent the same invoice number several times. Do you have an answer to that question, please?
Hi, @alena-marchenko
I faced the same issue when set the payment action to order. IPN (type = Order Created) from paypal which i assume it's the instruction for order creation but failed. This cause the order ID or invoice ID is captured in Paypal but not created in Magento due to unknown reason. So that invoice ID will continue be used to send request to paypal but rejected.
Maybe changing the setting in paypal can get pass this issue, but i don't think it's desired since it will cause management trouble.
Hi @SidneyBilliet
This issue can occur in case when you use/used your PayPal account on different Magento instances, so there has been already created transaction with such invoice id on PayPal side.
@alena-marchenko Hi, I'm a colleague of @SidneyBilliet and I have to tell that the issue still isn't resolved. This because the problem is not related to PayPal on it's own.
This ticket also describes the problem: #4474
So the steps to reproduce:
When you're a guest user you can simply remove your cookies to try again, but when you're logged in with your account the ID is related to your account and the only solution is to remove the quote in the db.
Hi @SidneyBilliet , @stevenvdp, @Nerogee
We've created MAGETWO-54412 internal ticket regarding this issue
Hi @alena-marchenko, do you have any updates on this issue?
Thanks in advance!
Hi @SidneyBilliet
The fix is delivered to develop branch. Closing the issue.
SALES_ORDER_INCREMENT_ID_STORE_ID in db you need to update your order incremented id. that issue is occuring due to the incremented id already used by paypal.
internally incremented id is used in payap order unique id, if it already used in paypal then you will get such issue.