Movatterモバイル変換


[0]ホーム

URL:


Test error conditions with negative testing

APICurrent

Last updated: Sept 24th, 12:48am

Important: Negative testing in the sandbox is in beta.

Negative testing lets you force the flows through specific error conditions that you want to test to ensure you handle errors correctly. Use negative testing to trigger the following types of errors:

  • Errors that result from calling a PayPal API.
  • Errors related to Virtual Terminal and theDoDirectPayment operation, which relate to verification and credit card validation errors.

You can force two types of API errors: errors related to the transaction amount, and errors not related to the transaction amount.

Know before you code

Negative testing is only available for use with the following:

  • Sandbox environments. You cannot force or simulate error conditions in the live PayPal environment.
  • Classic PayPal API versions 2.4 and later.
  • Business accounts.

Enable negative testing

  1. Go to thedeveloper.paypal.com home page. Log into the Dashboard and select the menu below your name to selectDashboard.
  2. Under theSandbox heading in the left navigation column, selectAccounts.
  3. Locate the sandbox account for which you wish to enable negative testing. Choose a business sandbox account or you won't see the options you need.
  4. In theManage Accounts column, select the... symbol to display the menu choices.
  5. SelectView/Edit Account to see theAccount Details page that has theProfile tab selected by default.
  6. Select theSettings tab to display a list of options you can set.
  7. Set theNegative Testing option toOn.

The sandbox is now in the negative testing state for transactions that include the merchant. Without this configuration, the sandbox does not raise error conditions unless the error occurs through normal transaction processing.

Test methods

In the PayPal sandbox, you can pass inputs to simulate scenarios that mimic the actual API responses without calling downstream services.

You can use the following methods to conduct negative testing in the sandbox:

If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites.Manage cookies and learn more


[8]ページ先頭

©2009-2025 Movatter.jp