Testing and Go Live

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)

Mocked PayPal testingAnchorIcon

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 testingAnchorIcon

Prerequisites for Testing PayPal Disputes in Braintree Sandbox:

RequirementStatus / Notes
Braintree Sandbox accountActive and verified
PayPal Sandbox (Business + Personal)Accounts created and operational
Linked PayPal & Braintree accountsVerified via BT Gateway → Account Settings → PayPal
At least one transaction existsVerified via PayPal buyer history
Familiarity with Disputes lifecycle PayPal Disputes Docs
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

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 SwitchAnchorIcon

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 sandboxAnchorIcon

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?AnchorIcon

This solution is available for your development team internationally.

App switch compatibilityAnchorIcon

Review the following table to see how App Switch works in different environments. Use this information to check if things are working during testing and spot any situations where you might need to set up fallback handling.

PlatformBrowserModeAvailabilityNotes
iOSSafariDefault browser
iOSSafariPrivate
iOSSafariNot default App Switch redirects to the default browser Stem of the "i" App Switch redirects to the default browser
iOSChromeDefault browser App Switch redirects to a new tab in the same browser App Switch redirects to a new tab in the same browser App Switch redirects to a new tab in the same browser App Switch redirects to a new tab in the same browser
AndroidChromeDefault browser
AndroidChromeIncognitoFallback experience
AndroidChromeNot default App Switch redirects to a new tab in the same browser App Switch redirects in the default browser
AndroidFirefox/otherDefault App Switch redirects in the default browser App Switch redirects to a new tab in the same browser App Switch redirects to a new tab in the same browser

Best PracticesAnchorIcon

  • Non-default browser behavior
    If the buyer initiates checkout from a non-default browser, the return from App Switch may open in the buyer's default browser. Use the return URL to restore buyer session and repaint the checkout page to avoid errors.
  • Not eligible for iframe integrations
    App Switch is not supported in iframes. If your checkout page is embedded in an iframe, do not integrate App Switch.

Use cases that can be tested:AnchorIcon

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:AnchorIcon

  • Long-lived session or remember me flow

  • Face id or Biometric

How can I enable the above login methods ?AnchorIcon

  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:AnchorIcon

  1. System errors

  2. App launch failure

  3. Activity feed updates

  4. Non-App Switch flow screens

Test CasesAnchorIcon

Step 1: Dispute Creation

  1. Log in to PayPal Personal Sandbox
  2. Locate completed transaction
  3. Initiate dispute → Report a Problem
  4. Choose reason (e.g. Item Not Received)
  5. Submit dispute and record Case ID (e.g. PP-R-NBM-10123874)

Expected Result: Dispute is created, confirmation and Case ID received

image

Note:

Testing focused on transactional dispute reasons — specifically those associated with PayPal–merchant transactions that surface in the Braintree Disputes dashboard.

The following dispute types were verified and confirmed to appear and behave consistently in Braintree:

  • I haven’t received the item or service
  • I received an item or service that was different or not as described
  • I wasn’t satisfied with the seller’s offer
  • The seller’s website or product listing is incorrect or doesn’t exist anymore

Other dispute categories (e.g., billing or subscription issues and unauthorized activity) are managed solely within PayPal and do not create Braintree dispute records, as they are not linked to merchant transactions.

No behavioral differences were observed across dispute types — all cases followed the same flow, response handling, and synchronization pattern between PayPal Sandbox and the Braintree Sandbox dashboard.

Step 2: Reflection in Braintree

  1. Wait 5–10 minutes for sync
  2. Navigate to Disputes in Braintree Control Panel
  3. Confirm case is listed under Open
  4. Verify PayPal Case ID matches Braintree Transaction ID

Expected Result: Dispute visible in dashboard, IDs align

image

Step 3: Response Handling

  1. Open dispute in Braintree
  2. Validate available actions:
    • Escalate to PayPal
    • Respond to buyer
    • Accept the dispute
  3. Simulate escalation scenario

Expected Result: Dispute status updates; escalation reflected

image

image

Step 4: Escalation / Chargeback Handling

  1. Open dispute → Chargeback detail page
  2. Validate response options:
    • Proof of Fulfillment
    • Proof of Refund
    • Other
  3. Upload mock evidence (PDF receipt, tracking ID)Confirm system updates buyer

Expected Result: Evidence accepted, dispute updated

image

image

Observations

  • Disputes appear in Braintree within ~5 minutes of creation.
  • Case Number format follows PayPal convention: PP-R-XXX-########.
  • Buyer sandbox account updates may take up to 24h to reflect.
  • Dispute reports allow precise mapping of Braintree and PayPal identifiers.
    • In Braintree’s dispute reporting (CSV export or API), the following columns are key for linking PayPal and Braintree dispute records:
      • Dispute ID – Unique Braintree dispute identifier.
      • Case Number – Mirrors the PayPal Case ID (e.g., PP-R-NBM-10123874).
      • Transaction ID – Corresponds to the Braintree transaction involved in the dispute.
      • PayPal Payer Email – Matches the buyer’s PayPal account email used in the original transaction.
    • This field combination allows one-to-one reconciliation between Braintree disputes and their PayPal counterparts.

    • During QA validation, all sandbox disputes displayed consistent Case Number values across the Braintree dashboard, CSV report, and API responses — no mismatches were detected.

    • The mapping also supports downstream reconciliation for merchant reporting, since both the Case Number and Transaction ID are included in the export schema.

  • Dispute response interface accepts both documents and typed responses.

Reference – Key Fields in Braintree Dispute ReportingAnchorIcon

FieldSourceDescription/Use
Dispute IDBraintreeInternal Braintree identifier for the dispute
Case NumberPayPalPayPal Case ID mirrored in Braintree
Transaction IDBraintreeTransaction reference linked to the dispute
PayPal Payer EmailPayPalBuyer email linked to the PayPal account
Amount Disputed / Amount WonBraintreeUsed to track financial outcomes of the dispute
Status / ReasonBothDisplays current dispute state and reason category
Received Date / Last UpdatedBraintreeUseful for timing and synchronization checks
Protection LevelBraintreeIndicates eligibility for PayPal Seller Protection


Go LiveAnchorIcon

Create an API userAnchorIcon

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 authorization errorauthorization errorauthorization errorauthorization errorauthorization errorauthorization error.

Get production credentialsAnchorIcon

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 settingsAnchorIcon

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 configurationAnchorIcon

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

  1. Ruby
gateway = Braintree::Gateway.new(
  :environment => :production,
  :merchant_id => "use_your_merchant_id",
  :public_key => "use_your_public_key",
  :private_key => "use_your_private_key",
)
  1. C#
var gateway = new BraintreeGateway
{
    Environment = Braintree.Environment.PRODUCTION,
    MerchantId = "YOUR_PRODUCTION_MERCHANT_ID",
    PublicKey = "YOUR_PRODUCTION_PUBLIC_KEY",
    PrivateKey = "YOUR_PRODUCTION_PRIVATE_KEY"
};
  1. Python
gateway = braintree.BraintreeGateway(
    braintree.Configuration(
        braintree.Environment.Production,
        merchant_id="use_your_merchant_id",
        public_key="use_your_public_key",
        private_key="use_your_private_key"
    )
)
  1. PHP
$gateway = new Braintree\Gateway([
    'environment' => 'production',
    'merchantId' => 'use_your_merchant_id',
    'publicKey' => 'use_your_public_key',
    'privateKey' => 'use_your_private_key'
]);
  1. Node
const gateway = new braintree.BraintreeGateway({
  environment: braintree.Environment.Production,
  merchantId: "YOUR_PRODUCTION_MERCHANT_ID",
  publicKey: "YOUR_PRODUCTION_PUBLIC_KEY",
  privateKey: "YOUR_PRODUCTION_PRIVATE_KEY"
});
  1. Java
BraintreeGateway gateway = new BraintreeGateway(
  Environment.PRODUCTION,
  "YOUR_PRODUCTION_MERCHANT_ID",
  "YOUR_PRODUCTION_PUBLIC_KEY",
  "YOUR_PRODUCTION_PRIVATE_KEY"
);

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 productionAnchorIcon

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 settlement, and then confirm that the funds have deposited into your bank account. This typically happens a few days after they have settled.