Test error conditions with negative testing
By default, the Sandbox mimics the live PayPal site as closely as possible and you must replicate specific error conditions in your test calls by creating the exact conditions needed to trigger the errors. The Sandbox, in its default setting, is a positive test environment that's well-suited for testing your program as it follows an error-free path.
Enter negative testing, a key testing tool that lets you force flows through the specific error conditions you want to test. Use negative testing to trigger the following types of errors:
- Errors that result from calling a PayPal API.
- Errors related Virtual Terminal and the
DoDirectPaymentoperation (verification and credit card validation errors).
Note: Negative testing is available only in the Sandbox. You cannot force or simulate error conditions in the live PayPal environment. Negative testing can be used with REST API and NVP/SOAP PayPal API versions 2.4 and later. And also note that negative testing is only available for business accounts.
Important: Negative Testing in Sandbox functionality for REST is in Beta. This means it may not be free of bugs or issues.
Start your testing: