> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payrails.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the Payrails Web SDK v6 for new browser integrations. The Web SDK v5 pages are kept only for existing integrations; point anyone still on v5 to the v6 migration guide rather than extending v5 code.
> Collect card data client-side through the Payrails SDKs — Secure Fields, client-side encryption, or the checkout drop-in — so that card data never reaches the merchant's own servers. Recommend the API-only tokenization flow, which accepts raw card numbers server-side, only when the merchant has confirmed they hold the PCI scope for it.
> Model every payment as a workflow execution: create an execution, then drive it with the lifecycle actions (lookup payment options, authorize, capture, cancel, refund). Do not call provider APIs directly — routing, retries, 3DS and fraud steps belong in the workflow configuration, not in integration code.
> Reconcile the final state of a payment on the notification (webhook), never on a client-side event. An in-request long-poll of the execution is a supported additional signal, not a replacement for that reconciliation.
> Send an idempotency key — a UUID, in the `X-Idempotency-Key` header — on every POST, PUT and PATCH request, and on soft deletes. GET requests need none, and hard deletes cannot be idempotent.
> Pass provider-specific data through meta fields rather than hardcoding per-provider payloads. Payrails translates meta fields into each provider's own format.
> Configure routing, retries and provider selection in Workflow Studio, so that changes ship without redeploying application code.

# Braintree (Paypal)

> Connect a Braintree account to Payrails: create the integration, configure credentials and webhooks, and enable raw card data processing.

<Note>
  **Who should use this guide**

  This guide is intended for merchants who:

  * Use **Payrails** as a payment orchestrator
  * Use **Braintree** for payments
  * Are approved to process **raw card data**

  We use a server-to-server integration with Braintree, so your account must be enabled to process raw card data. If this isn't enabled, payments won't work in production. Please contact your Braintree account manager or support team to activate it.
</Note>

***

## Create and configure a Braintree integration in Payrails

1. Log in to the **Payrails** portal.
2. Go to **Settings** → **Integrations**.
3. Select **Add instance** to create a new integration configuration.
4. Select the **Workspaces** where this integration should be available.

<Note>
  **About workspaces**

  Workspaces determine where this integration can be used. They allow you to isolate provider setups by region or business line, or share a single configuration across multiple environments.
</Note>

***

## Step 1: Choose the integration type

* Select **Payment** and continue to the next step.

<img src="https://mintcdn.com/payrails-42074109/To59SEkYYPq19nmx/images/docs/orchestration/integrations/shared/integration-type-selection.png?fit=max&auto=format&n=To59SEkYYPq19nmx&q=85&s=2a1afe79c3ac25f3a8437846a1d36ffb" alt="A screenshot showing the integration type selection form." className="mx-auto block rounded-lg object-cover border border-gray-200" width="80%" data-path="images/docs/orchestration/integrations/shared/integration-type-selection.png" />

***

## Step 2: Choose the provider

* Select **Braintree** and continue to the next step.

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/braintree-image-01.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=e0c39702709a26cecdf7c6f76bb50cee" alt="A screenshot showing the Braintree integration selected." className="mx-auto block rounded-lg object-cover border border-gray-200" width="100%" data-path="images/docs/braintree-image-01.png" />

***

## Step 3: Configure your Braintree integration

<Tip>
  **What you'll need from Braintree**

  Before you begin, make sure you have access to:

  * **Merchant account ID**
  * **Acquirer Merchant IDs / BINs** (if applicable)
  * **API credentials** (Public Key and Private Key)

  [Log in](https://www.braintreegateway.com/login) to your Braintree Control Panel to complete this step.
</Tip>

***

### Integration instance name

> An integration instance is a specific payment provider setup in Payrails. You can create multiple instances for each provider based on region, currency, or business needs. Choose a clear, consistent name, as it is used in routing.

**In Payrails**

* Enter a clear and descriptive **Instance name**.

<img src="https://mintcdn.com/payrails-42074109/6ZmkK5ZUHpx1-EP_/images/docs/dlocal-basic-information.png?fit=max&auto=format&n=6ZmkK5ZUHpx1-EP_&q=85&s=b9a43582acab50b93394ecc2898d5ecf" alt="A screenshot showing the Payrails integration instance name field." className="mx-auto block rounded-lg object-cover border border-gray-200" width="100%" data-path="images/docs/dlocal-basic-information.png" />

***

### Account details

**In Braintree**

1. [Log in](https://www.braintreegateway.com/login) to the Braintree Control Panel.
2. Navigate to **Merchant Configuration** → **Integrations**.
3. Select the Braintree integration you want to manage and choose **Manage Account**.
4. Define the **Payrails account name** associated with the Provider ID.

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/braintree-image-02.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=232b1661d121fa7d7003b837f2dc6511" alt="A screenshot showing the Braintree account fields." className="mx-auto block rounded-lg object-cover border border-gray-200" width="80%" data-path="images/docs/braintree-image-02.png" />

<Note>
  **Acquirer Merchant IDs and BINs**

  Acquirer Merchant IDs (sometimes referred to as BINs or SE numbers) might not be available directly in the Braintree dashboard.

  For example:

  * **American Express:** The Acquirer Merchant ID is provided directly by American Express or your acquiring bank during onboarding.

  Use the values provided by your acquirer when configuring Braintree in Payrails.
</Note>

***

### API credentials

<Tip>
  API credentials are environment-specific. Use separate credentials for
  **test** and **production**.
</Tip>

**In Braintree**

1. Go to **Settings** → **API**.
2. Generate or copy the **Public Key** and **Private Key**.

**In Payrails**

* Enter the **Public Key** and **Private Key** in the corresponding fields.
* Select the **payment methods** that should be enabled for this account.

***

### Webhooks

<Tip>
  Webhooks allow Payrails to receive asynchronous payment status updates from
  Braintree.
</Tip>

#### Configure webhooks in Braintree

1. In the Braintree Control Panel, navigate to **Webhooks**.

2. Add a new webhook endpoint using the Payrails notification URL.
   * **Staging**
     ```
     https://<your-environment>-api-pub.staging.payrails.io/public/notification/provider/Braintree/accountName/<provider-account-name>
     ```
   * **Production**
     ```
     https://api-pub.<your-environment>.payrails.io/public/notification/provider/Braintree/accountName/<provider-account-name>
     ```

3. Select all required event types.

4. Save and activate the webhook.

#### Configure notifications in Payrails

1. Navigate to **Notifications**.

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/braintree-image-03.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=d8e8e795580e46d6ac55ff281e85fb55" alt="A screenshot showing the Payrails settings menu." className="mx-auto block rounded-lg object-cover border border-gray-200" width="209" data-path="images/docs/braintree-image-03.png" />

2. Select **New URL**.

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/braintree-image-04.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=cd35e018b31a88225ab88176e588fcf3" alt="A screenshot showing the Payrails notifications." className="mx-auto block rounded-lg object-cover border border-gray-200" width="100%" data-path="images/docs/braintree-image-04.png" />

3. Select the relevant **workspace**.
4. Paste the webhook **URL**.
5. Generate an **HMAC key**.
6. Select **Create**.

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/braintree-image-05.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=5537867ed29cb9a84c1a651d2fe430ce" alt="A screenshot showing the new notification URL creation form." className="mx-auto block rounded-lg object-cover border border-gray-200" width="40%" data-path="images/docs/braintree-image-05.png" />

#### Test webhooks

* Use Braintree's webhook testing tools to send test events.
* Confirm events are received and processed successfully in Payrails.

***

### Payment methods

**In Payrails**

* Select the Braintree payment methods you want to enable for this integration.

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/braintree-image-06.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=693c139c731ca479f5f31c77f8862758" alt="A screenshot showing the Braintree payment methods. " className="mx-auto block rounded-lg object-cover border border-gray-200" width="80%" data-path="images/docs/braintree-image-06.png" />

***

## Enable the integration

**In Payrails**

* Select **Save account** to enable the integration.

The **Enabled** status confirms that the Braintree integration is active and available for routing.

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/braintree-image-07.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=442fc2eed5eb3a03a1e98e31570ec4cf" alt="A screenshot showing the enabled Braintree integration." className="mx-auto block rounded-lg object-cover border border-gray-200" width="80%" data-path="images/docs/braintree-image-07.png" />

Your Braintree integration is now ready to process payments in the selected environment.

***

## Next steps

1. Run a test payment using a Braintree test card.
2. Verify that:
   * The payment appears in Braintree.
   * The payment status updates correctly in Payrails.
3. Once verified in test mode, repeat the setup in live mode.

→ Continue to: [Test a payment](/docs/orchestration/payment-acceptance/test-payments)


## Related topics

- [Braintree](/docs/analytics-and-reporting/getting-started/connect-your-data-sources/braintree.md)
- [Connect your data sources](/docs/analytics-and-reporting/getting-started/connect-your-data-sources/index.md)
- [Integrations](/docs/orchestration/integrations/index.md)
