Test REST API transactions

PayPal provides a sandbox environment for you to test functionality. You can create sandbox accounts, view account notifications, view REST API calls, view webhook events, and simulate IPNs.

The Sandbox API Calls dashboard lists REST API calls that are tied to your sandbox account. The Live API Calls dashboard lists REST API calls in the live environment.

Use the dashboards to view the REST API call history for a specific app or all apps. Both dashboards list the REST API calls made by apps with related details. You can view the request and response messages of some REST API calls.

Integration steps

1. Required Meet the prerequisites.
2. Required Test credit card payments.
3. Required Test PayPal payments.

Prerequisites

  1. Get an access token.

    To get an access token, you must create a PayPal app. When you create an app, PayPal generates a set of OAuth client_id and secret keys for your app for both the sandbox and live environments. Then, to get an access token, you pass the client_id:secret credentials in the Authorization header in a get access token request. The authorization server issues an access token in exchange for your client ID and secret credentials. You use the access token for authentication when you make REST API requests.

    For more information, see make your first call. If you are a non-US developer, see International Developer Questions. You can use your sandbox access token to try any of the code in the REST API reference.

    Each API response includes HATEOAS links that enable you to construct a payment flow.

  2. To receive payments in a currency that you do not hold, first configure your Payment Receiving Preferences in your PayPal account. Otherwise, your payment status might be pending until you manually approve the payment in your PayPal account.

  3. To receive guest checkout payments, which allow credit cards, enable the PayPal Account Optional option in your account settings. The path to this option for US accounts is:

    Profile > My selling tools > Website preferences > PayPal Account Optional

  4. To test payments, create test buyer and merchant accounts in the PayPal sandbox. To create a test buyer account, select the Personal account type. To create a test merchant account, select the Business account type. See create sandbox accounts.

Test credit card payments

Note: Some countries restrict direct credit card payments and related features.

The dashboard shows transactions for successful API calls.

  1. Create a credit card payment.
  2. Click Log In to log in to your PayPal account.
  3. To review sandbox REST API calls, go to the Sandbox REST API Calls dashboard.

Note: For sandbox REST API calls, you can use the credit card numbers provided in your sandbox accounts.

For more information about credit card payments, see Accept credit card payments.

Test PayPal payments

To test PayPal payments, you must be able to see transactions from the perspective of the buyer.

  1. Click Log In to log in to your PayPal account.

  2. Create a PayPal payment.

  3. To approve the payment, enter the email address and password for your buyer account.

  4. Execute the payment.

  5. To review the details of the completed payment, log in to your buyer account on the sandbox site.

For more information about PayPal payments, see accept PayPal payments.

Additional information