Configure your sandbox and live accounts

DocsCurrentLast updated: July 19th 2023, @ 4:32:11 pm


Use a sandbox account to test purchases before going live in your live account. For example, when you initiate a purchase through a sandbox account, PayPal creates a test purchase that simulates a purchase in the live environment.

Note: Fill out this form to be an approved partner. You need to be an approved partner to go live. Calls to the PayPal Complete Payments Platform APIs without approval will return a 401 Unauthorized HTTP status code. You can call and test the PayPal Complete Payments Platform APIs with your sandbox credentials before you are approved.

Create your sandbox API caller account

Log in to your developer dashboard to create your platform REST app. A sandbox account is generated after you create your app. You can use an existing PayPal account or create a new PayPal account specifically for this PayPal Complete Payments Platform integration. Use your personal sandbox account to simulate a buyer making a payment and use your business sandbox account to simulate a seller receiving payment.

Create a platform REST app in your sandbox account

  1. From your developer dashboard, select Apps & Credentials.
  2. Under the REST API App, select the Create App.
  3. Under App Type, select Platform. A sandbox account with the recommended platform settings will be automatically created.

After the app is created, you can select which features you’d like to have enabled for testing under Sandbox App Settings. Some settings are automatically selected, but you can turn on other options for your use case.

Get your sandbox API credentials

  1. From your developer dashboard, select Testing Tools > Sandbox Accounts.
  2. Under Account Name, find the personal or business sandbox account you want to test with.
  3. Select the (…) button on the side > View/Edit Account > API Credentials.
  4. Under REST APPs, select the name of the app you are using.
  5. The client ID and client secret is at the top.

Log in to your sandbox account

Log in to your sandbox to test the result of API calls. To get an email ID and password for a sandbox account:

  1. From your developer dashboard, select Testing Tools > Sandbox Accounts.
  2. Under Account Name, find the personal or business sandbox account you want to test with.
  3. Select the (…) button on the side > View/Edit Account. Make note of your email ID and a system-generated password.
  4. Log in to your sandbox with this email ID and password.

Create your live API caller account

Use the live account when you are done testing on sandbox and want to go live with your integration. You must be an approved partner to go live. Fill out this form to be an approved partner and a PayPal representative will contact you for your approval. When you are ready to go live, you’ll need to reach out to your representative and configure the live account together.

Know before you set up your live account

  • You’ll need a PayPal business account. If you have a personal account, contact a PayPal representative to upgrade your account to a business account when you go live.
  • How the money is settled will change when the live account is configured. The live account will no longer contain a PayPal balance. We recommend using a new account that is not being used for any other transactions.
  • If you want to take a platform fee from your sellers, link and confirm your bank account to your PayPal account in the Money, banks, and cards page.
  • If you use the platform fee feature, your live account can only be used to transact the fee to your linked bank account from sellers. The balance of your partner account should remain empty. If you plan to transact with this account as a seller or collect payments directly from buyers, make another account to avoid having the payment automatically transferred to your linked bank account.

Note: If you’re planning to use the "platform fee" feature, and to avoid your sellers re-onboarding, you will want to pass the permissions scope as part of the onboarding Partner Referral API when your sellers onboard, and our team will also need to configure this feature on your account.

Create a live account

  1. If not done already, get a PayPal business account. For more information about business accounts, see Open a business account online.
  2. When you have created your account, go to your inbox and look for our email to confirm your email address.

Exchange your API credentials for an access token

Your access token authorizes you to use the PayPal REST API server. To call a REST API in your integration, exchange your client ID and secret for an access token. You can make the API call in any programming language.

The following sections explain how to get your access token using cURL or Postman.

Note: Platform App Type is only available in the United States, United Kingdom, Spain, Italy, France, Canada, and Australia. For other countries, first create a REST app. Then, contact PayPal for approval to access sandbox and go live.

cURL

Copy the following code and modify it:

  1. Change CLIENT_ID to your client ID.
  2. Change SECRET to your secret.

1curl -v POST https://api-m.sandbox.paypal.com/v1/oauth2/token \
2 -H "Accept: application/json" \
3 -H "Accept-Language: en_US" \
4 -u "CLIENT_ID:SECRET" \
5 -d "grant_type=client_credentials"
To import the cURL command above to Postman:
  1. Open Postman and go to Import > Raw text.
  2. Paste the cURL command into the text field.
    • Change CLIENT_ID to your client ID.
    • Change SECRET to your secret.
  3. Select Continue > Import > Send.

Step result

PayPal returns an access token and the number of seconds the access token is valid. When you make calls to a REST API, include the access token in the Authorization header with the designation as Bearer. Reuse the access token until it expires.

When your token expires, call the v1/oauth2/token method again to request a new token.

Sample response

1{
2 "scope": "https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer https://uri.paypal.com/services/payments/realtimepayment https://uri.paypal.com/services/disputes/update-seller https://uri.paypal.com/services/payments/payment/authcapture openid https://uri.paypal.com/services/disputes/read-seller https://uri.paypal.com/services/payments/refund https://api-m.paypal.com/v1/vault/credit-card https://api-m.paypal.com/v1/payments/.* https://uri.paypal.com/payments/payouts https://api-m.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/applications/webhooks",
3 "access_token": "A21AAFEpH4PsADK7qSS7pSRsgzfENtu-Q1ysgEDVDESseMHBYXVJYE8ovjj68elIDy8nF26AwPhfXTIeWAZHSLIsQkSYz9ifg",
4 "token_type": "Bearer",
5 "app_id": "APP-80W284485P519543T",
6 "expires_in": 31668,
7 "nonce": "2020-04-03T15:35:36ZaYZlGvEkV4yVSz8g6bAKFoGSEzuy3CQcz3ljhibkOHg"
8}

Credential reference

The following credentials are used in integrating and testing REST APIs. The steps are the same for both sandbox and live. Make sure to toggle to the right environment that you are working in.

Client ID (sandbox and live)

Used to generate the access token required to make PayPal API calls in sandbox and live.

To find it:

  1. From your developer dashboard, select Apps & Credentials.
  2. Select the app you are using. Your client ID is at the top.

BN code

Identifies the caller as a PayPal partner. To receive revenue attribution, specify a unique build notation (BN) code. BN codes provide tracking on all transactions that originate or are associated with a particular partner. Required for PayPal reporting. See PayPal-Partner-Attribution-Id for more information.

To find it:

  1. From your developer dashboard, select Apps & Credentials.
  2. Select the app you are using.
  3. Under App Settings, scroll down to Reports. Your BN code is on the last line of Reports.

Partner-merchant-id

The partner-merchant-id or payer ID is a unique identifier assigned to every PayPal account. This value does not change over the life of the PayPal account. The partner needs one account (which has one payer ID), and each of the sellers need their own PayPal accounts (which have their own unique payer IDs).

To find it:

  1. From your developer dashboard, select Testing Tools > Accounts.
  2. Under Account Name, find your account.
  3. Select the (…) button on the side > View/Edit Account to display your account ID.