If you have a PayPal Sandbox test account, you can set it up in the Adyen test environment. The setup is very similar to granting the Adyen API access to a live PayPal account. With a PayPal Sandbox test account, you need to make sure that the Adyen test API user can access it to carry out the payment operations you want to test.
PayPal Sandbox accounts come in two flavors:
- Business: represents a merchant's PayPal account in a transaction.
- Personal: represents a shopper's PayPal account in a transaction.
PayPal automatically creates your first Sandbox Business and Personal test account by cloning your live account and by appending the -facilitator and -buyer suffix respectively to your email name.
Follow PayPal's instructions to create your Sandbox Business and Personal accounts.
Set up your Business account to use it as a test merchant account in the Adyen test environment, the setup is very similar to granting the Adyen API access to a live PayPal account. With a PayPal Sandbox test account, you need to make sure that the Adyen test API user can access it to carry out the payment operation you want to test.
Make sure you are logged in with the created Facilitator/Business account, not as the user who setup the sandbox accounts, on https://sandbox.paypal.com/ while adding these API rights.
Follow the steps described in PayPal account setup and use the values listed below.
In the Add New Third Party Permissions window, go to the Third Party Permission Username field, and instead of entering
paypal_api2.adyen.com, input the following username:
- Click Lookup to generate a list with the available permissions for the specified API.
- In the API permission list, select the following checkboxes:
- Use Express Checkout to process payments.
- Issue a refund for a specific transaction.
- Process your shopper's credit or debit card payments.
- Authorize and capture your PayPal transactions.
- Obtain information about a single transaction.
- Obtain authorization for pre-approved payments and initiate pre-approved transactions.
- Generate consolidated reports for all accounts.
(In some countries, you might get an error message informing you that the feature is not available in the country where you have your PayPal account. In this case, uncheck/deselect this option.)
- Use Express Checkout to process mobile payments.
(If you do not support or plan to support mobile payments, leave this option unchecked.)
- Click Add.
After completing this task, contact our support team to notify the PayPal Sandbox Business test account email address you want to use for your PayPal test payment integration.
For testing, use the PayPal Sandbox personal shopper email address you specified in your PayPal developer environment. Using your own shopper email allows keeping track of your test payments in the PayPal sandbox at a shopper level.
Sandbox mimics the live PayPal site as closely as possible and the default setting is a positive test environment where you can test your system or application as it follows an error-free path. To reproduce specific error conditions, your test cases need to recreate the exact scenarios that trigger those errors to verify that the system or application under test works as expected.
Negative testing is a testing methodology that allows you force flows through the specific error conditions you want to test to verify that the system or application under test can gracefully handle situations that break the happy flow. For example, negative testing checks that the system or application under test can handle errors by throwing exceptions and returning descriptive error messages that can help understand and solve the problem instead of crashing.
To enable this method:
- Log in to your PayPal developer account.
- On the Account landing page, click Dashboard.
- In the sidebar on the left, under Sandbox, click Accounts.
- In the account overview list, expand the desired account you want to edit, then click Profile.
- In the Account details popup dialog window, select the Settings tab.
- On the Settings tab, set Negative testing to ON.
- Click Close.
This sets the sandbox to the negative testing state for transactions. Without this configuration, the sandbox does not raise error conditions.
After enabling negative testing for a sandbox profile, your account expects transaction amounts to be handled as error codes. To go back to normal positive testing, set Negative testing to Off.
Negative test examples
The type of error you want to trigger defines the actual value you need to pass. For example, you can use the '10606' value to trigger a Transaction rejected error.
To trigger an error condition on a field related to the amount, specify an error code value as a minor unit, as you would normally do for a standard payment. On our test platform, the following error codes are mapped to the corresponding refusal reasons:
Error code / Amount
|10069||Payment refused due to risk; user notification necessary.|
|10411||This express checkout session has expired.|
|10417||Transaction cannot complete.|
|10422||Customer must choose new funding sources.|
|10445||This transaction cannot be processed at this time. Please try again later.|
|10485||Payment not authorized.|
|10486||This transaction could not be completed.|
Transaction rejected, please contact the buyer. Buyer cannot pay.
|10736||Shipping address invalid city state postal code.|
|11084||User does not have a good funding source with which to pay.|
|11607||Duplicate request for specified Message Submission ID.|
|13113||Buyer cannot pay.|
There are more errors codes and refusal reasons on our live platform, but not all of them are mapped in the test environment. The mapped error set above allows carrying out targeted negative testing on PayPal transactions in our test environment to verify that your system can handle incomplete or erroneous transactions in a live environment.