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.
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.
|1.||Required||Meet the prerequisites.|
|2.||Required||Test credit card payments.|
|3.||Required||Test PayPal payments.|
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
secretkeys for your app for both the sandbox and live environments. Then, to get an access token, you pass the
client_id:secretcredentials in the
Authorizationheader 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.
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.
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
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.
- Create a credit card payment.
- Click Log In to log in to your PayPal account.
- 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.
Click Log In to log in to your PayPal account.
To approve the payment, enter the email address and password for your buyer account.
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.