PayPal

Testing and Go Liveanchor

You can test your PayPal integration in the Braintree sandbox environment in 2 ways:

  • Mocked PayPal testing (default)
    • Behaves similarly to production but does not allow for end-to-end testing
    • Uses Braintree sandbox test values to simulate PayPal responses in your Braintree sandbox
    • Allows you to confirm that your client- and server-side configurations are correct and that you are receiving appropriate responses for your requests
    • Does not return data to your PayPal sandbox account
    • Does not work with the PayPal Checkout component of the JavaScript v3 SDK
  • Linked PayPal testing
    • Requires additional setup
    • Directly connects your Braintree sandbox account to your PayPal sandbox account
    • Returns data to both sandbox accounts
    • Allows you to test the full functionality of your PayPal integration (e.g. transaction reporting, email receipts)
important

Do not use your PayPal business account as the PayPal customer account when paying for test transactions in the linked PayPal flow or in production. Doing so will result in declines.

Mocked PayPal testinganchor

Use your Braintree sandbox API credentials and the test values on our Testing page to ensure your client and server integrations with Braintree are working as expected.

Any testing you do in the mocked PayPal flow will only be reflected in your Braintree sandbox – no data will be sent to your PayPal sandbox. If you'd like to do complete end-to-end testing, see linked PayPal testing.

Linked PayPal testinganchor

In order to link a PayPal sandbox test account to your Braintree sandbox account, you will need the API credentials for that PayPal sandbox test account.

If you don't already have a PayPal sandbox test account for testing your Braintree integration, create a new one by following these steps:

  1. Create a PayPal business sandbox account:
    • Log into the PayPal Developer Dashboard
    • Navigate to Sandbox > Accounts
    • Select the account type as Business
    • Select the same Country as your Braintree sandbox account
    • Select Create Account
  2. Go to the Create New App page
    • Create an app to get sandbox API credentials
    • Select the same sandbox developer account as the test account created in step 1
  3. Note the following Sandbox API Credentials for the new app you created:
    • Email address associated with this app
    • Client ID
    • Secret
note

After successful link of your PayPal account with your Braintree account, some fake nonces (e.g. fake-paypal-one-time-nonce) may stop working.

Once you have those PayPal sandbox API credentials, enter them in your Braintree sandbox:

  1. Log into your Braintree sandbox Control Panel
  2. Navigate to Settings > Account Settings > Payment Methods > PayPal
  3. Select Link Sandbox
  4. Enter the Email address, Client ID, and Client Secret for your PayPal sandbox test account
  5. Select Link PayPal Sandbox

Testing App Switchanchor

App Switch allows PayPal customers who have the PayPal app installed to complete their transaction in the PayPal app, streamlining checkout with strong multi-factor authentication. This feature can be tested in both the PayPal production app and sandbox environments. To test App Switch, make sure your integration is:

  • App Switch eligible.
  • You have completed the PayPal App Switch integration.

Testing your integration using PayPal's sandboxanchor

PayPal's sandbox application allows PayPal users, both inside and outside the United States, test the app switch consumer experience.

Who is this solution intended for?anchor

  • This solution is available for your development team internationally.

Use cases that can be tested:anchor

ScenarioExpected Behavior
User starts from a Native Default browser such as Safari on an iOS device or Chrome on an Android device (Happy Path).The user is switched to the PayPal app and, upon successfully completing the checkout flow, is switched back to the same merchant browser tab they started from.
User starts from a Non-Native default browser such as Chrome on iOS or Firefox on Android.The user is App switched to the PayPal app and, upon successfully completing the checkout flow, is switched back to the user’s default browser.
Post App Switch changes the payment method on the pay sheet and completes the flow.Completing checkout flow with the successful creation of BA token/payment token.
Post Login cancel the operation on the pay sheet screen in the PayPal App.The user is switched back to the merchant browser upon canceling out of the checkout flow.
Add a new card.When the user clicks 'Add Card,' they will be prompted to log in again. After logging in, the new card form will be displayed. After the new card is added, the user can proceed with checkout.

Preconditions:anchor

  • Long-lived session or remember me flow

  • Face id or Biometric

How can I enable the above login methods ?anchor

  1. Login to your PayPal app. On the home screen, select the avatar icon.
  2. On the Personal account screen, select the Login and security option.
  3. The Login and security screen should show the face-id/fingerprint and Extend your login session options disabled.
  4. Click the toggle icon to enable each login method.

Use cases that cannot be tested:anchor

  1. System errors

  2. App launch failure

  3. Activity feed updates

  4. Non-App Switch flow screens

note

To learn more about testing App Switch in our mobile environment, select iOS or Android from the dropdown menu at the beginning of the page.

Go Liveanchor

important

Your sandbox account is not linked to your production account in any way. Nothing created in the sandbox will transfer to production. This includes processing options and recurring billing settings. Your login information, merchant ID, and API keys will also be different.

Create an API useranchor

Production API credentials, including your API keys, must be entered into your server-side code to connect API calls to the Braintree gateway. While each user in your gateway has their own unique set of API keys, only one set can be included in your integration.

We do not recommend including an individual user's API credentials. If you ever need to delete or suspend that user, this could break your connection to Braintree and result in failed transactions.

Instead, create a new user specifically designated as the API user, whose API keys can be used for your integration. This user should be set up with an email address that is not associated with a single employee and should have Account Admin permissions in order to avoid issues such as an .

Get production credentialsanchor

Log into your production account as the API user to obtain your API credentials. You'll need the:

  • Production merchant ID
  • Production public key
  • Production private key

Keep in mind that public and private keys are both environment- and user-specific.

Update production account settingsanchor

Make sure your production account settings mirror the ones in your tested sandbox configuration. Be sure to recreate any recurring billing plans or settings if you plan to use recurring billing in production.

Update live server configurationanchor

In your server code, update your configuration to production values:

Once you have updated these values and configured your preferred processing settings, the live production environment will function similarly to the sandbox environment you've been using for development. Learn more about the differences between production and the sandbox.

On the client side, no configuration updates are needed when you make the switch to production – your client obtains its client token from your server, which is all the configuration it needs.

Test transactions in productionanchor

It is important to test your production account by creating a couple of low-value sale transactions for each of the payment method types you plan to accept. Be sure to submit the transactions for , and then confirm that the funds have deposited into your bank account. This typically happens a few days after they have settled.

important

Real payment methods must be used in the production environment. Test values from the sandbox testing page will not work. This means that every test transaction that you allow to settle in your production account will debit funds from the associated payment method and fees will be assessed. Be sure to test with reasonable amounts and only run a limited number of transactions.