2012

Table Of Contents
Sandbox User Guide April 2012 45
7
Testing Error Conditions
In default operation, the Sandbox mimics the live PayPal site as closely as possible, which
means that an error can be replicated only by creating the exact conditions and sequence of
events to raise an error. This positive test environment is well-suited for testing logic that
follows the typical error-free path; however, it can be difficult to raise error conditions and test
logic to handle errors.
The Sandbox can be set to allow negative testing, which enables you to simulate an error. You
can test against the following kinds of errors:
errors that result from calling a PayPal API
address verification and credit card validation errors that occur when using Virtual
Terminal or calling DoDirectPayment.
IMPORTANT: Negative testing is only available for Version 2.4 and later of PayPal APIs.
You raise an error condition by setting a value in a field passed to an API or setting a value in
a field submitted to Virtual Terminal. The value triggers a specific error condition. Negative
testing is available only in the Sandbox; you cannot force or simulate an error on the live site.
You must create a Business test account and enable negative testing; otherwise, setting a value
in the API or transaction will not raise an error unless the error would be raised in the default
positive test environment. To enable negative testing, set Test Mode to Enabled. The
following screen shows two Business accounts. The first test account enables negative testing;
the second account disables negative testing.
To test Virtual Terminal, you must set risk controls for address verification and credit card
security, respectively, to Decline or Accept and Report depending on the kind of negative
testing you want to perform. If you do not set the appropriate risk controls, default processing
occurs, which is to accept the transaction.
Severe error conditions, such as bad arguments or invalid login, preempt negative testing
because the error cannot be handled by either negative testing or positive testing. In these