How do I avoid duplicate transactions?
Blocking duplicate invoice IDs
To avoid duplicate transactions, you need to pass an invoice number to the PayPal system. This feature is available for PayPal Payments Standard (also known as Website Payments Standard) and PayPal Payments Pro (SOAP and NVP). Once you configure your profile to block duplicate invoice numbers, PayPal will check whether each passed invoice number has already been paid in your account. For example, if invoice 1001 has been paid, 1001 will be denied if it is passed to the PayPal account a second time.
Here's how to block duplicate invoice IDs in your profile:
- Log in to your PayPal account.
- Select Profile > Profile and settings.
- Click My selling tools.
- Click Update next to Block payments.
- Select Yes, block multiple payments per invoice ID under Block accidental payments.
- Click Save.
<input type="hidden" name="invoice" value="001">
Note: You can't add this code to a button originally created as encrypted.
Passing invoice IDs to PayPal Payments Pro
For PayPal Payments Pro, the parameter you pass depends on the type of API calls you're making.
- For SOAP, use
- For NVP, use
When a duplicate transaction uses the same PayPal-Request-Id, it will return the following example response:
[name] => DUPLICATE_REQUEST_ID [message] => The value of PayPal-Request-Id header has already been used [information_link] => https://developer.paypal.com/webapps/developer/docs/api/#DUPLICATE_REQUEST_ID [debug_id] => b008929a73c5f
See REST API authentication and headers for more information on using PayPal-Request-Id.
PayPal Payments Pro returns API error code 10412 if it detects a duplicate invoice number. For a complete list of API error codes, and details regarding the 10412 error, see API error codes.