Configure your sandbox and live accounts

DocsCurrent

Last updated: Apr 10th, 7:11pm

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.

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. Select Create App.
  3. Under Type, select Platform. A sandbox account named Platform Partner App is automatically created with the recommended platform settings.

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 API 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.


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 client 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.

cURL

Copy the following code and modify it:

  1. Change CLIENT_ID to your client ID.
  2. Change CLIENT_SECRET to your client secret.
    1curl -v POST https://api-m.sandbox.paypal.com/v1/oauth2/token -u "CLIENT_ID:CLIENT_SECRET" -H "Content-Type: application/x-www-form-urlencoded" -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 CLIENT_SECRET to your client 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 the account ID assigned to every PayPal account. The account ID is a unique identifier and doesn't change over the life of the PayPal account. Partners and sellers need their own PayPal accounts, and every account has its own account ID.

      To find it:

      1. From your developer dashboard, select Testing Tools > Sandbox Accounts.
      2. Under Account Name, find your account.
      3. Click on the account name and scroll down to Account Info to see the account ID.

      Next steps

      Add more payment methods

      Required
      Accept Payments

      Choose your payment method.