> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/braintree.md).

# Braintree

Braintree is a payments platform by PayPal. Process sale transactions, refunds, and voids, and manage customers and subscriptions.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication |
| --------- | -------------- |
| Braintree | Credentials    |

#### Braintree

Connect to the Braintree payments platform (a PayPal service) to process transactions and manage customers via the GraphQL API.

**Set up in Braintree**

1. Prepare the Braintree account or service that the workflow will access. Grant access to the required resources and operations.
2. **Public Key:** Your Braintree public key, from the Control Panel under Settings > API Keys.
3. **Private Key:** Your Braintree private key, from the Control Panel under Settings > API Keys.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Braintree**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field | Required                 | What to enter                                                                                                                                                                                                                                                        |
| ------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Public Key    | Yes                      | Your Braintree public key, from the Control Panel under Settings > API Keys.                                                                                                                                                                                         |
| Private Key   | Yes                      | Your Braintree private key, from the Control Panel under Settings > API Keys.                                                                                                                                                                                        |
| Sandbox       | Optional / as applicable | Connect to the Braintree sandbox environment instead of production. API keys are environment-specific: enable this only for a sandbox keypair. [Provider instructions](https://developer.paypal.com/braintree/articles/control-panel/important-gateway-credentials). |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Braintree** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Create Transaction

Charge a payment method to create a Braintree sale transaction.

**Inputs**

| Field               | Type   | Required | Description                                                     |
| ------------------- | ------ | -------- | --------------------------------------------------------------- |
| Payment Method ID   | string | Yes      | Single-use or vaulted payment method to charge.                 |
| Amount              | string | Yes      | Amount to charge, as a decimal string.                          |
| Order ID            | string | No       | Optional merchant-defined order reference.                      |
| Customer ID         | string | No       | Optional Braintree customer to associate with the charge.       |
| Merchant Account ID | string | No       | Optional merchant account to process the charge with.           |
| Idempotency Key     | string | No       | Optional idempotency key to prevent double-charging on retries. |

**Outputs**

| Field          | Type   | Description                                                  |
| -------------- | ------ | ------------------------------------------------------------ |
| Transaction ID | string | GraphQL ID of the created transaction.                       |
| Status         | string | Status of the transaction (e.g. SUBMITTED\_FOR\_SETTLEMENT). |
| Transaction    | object | The created transaction.                                     |

#### Refund Transaction

Refund a settled Braintree transaction, fully or partially.

**Inputs**

| Field           | Type   | Required | Description                                                       |
| --------------- | ------ | -------- | ----------------------------------------------------------------- |
| Transaction ID  | string | Yes      | The settled transaction to refund.                                |
| Amount          | string | No       | Optional partial-refund amount; leave empty for a full refund.    |
| Order ID        | string | No       | Optional merchant-defined reference stored on the refund.         |
| Idempotency Key | string | No       | Optional idempotency key to prevent duplicate refunds on retries. |

**Outputs**

| Field     | Type   | Description                                             |
| --------- | ------ | ------------------------------------------------------- |
| Refund ID | string | GraphQL ID of the created refund.                       |
| Status    | string | Status of the refund (e.g. SUBMITTED\_FOR\_SETTLEMENT). |
| Refund    | object | The created refund.                                     |

#### Create Customer

Create a new customer in the Braintree vault.

**Inputs**

| Field        | Type   | Required | Description               |
| ------------ | ------ | -------- | ------------------------- |
| First Name   | string | No       | Customer's first name.    |
| Last Name    | string | No       | Customer's last name.     |
| Email        | string | No       | Customer's email address. |
| Company      | string | No       | Customer's company name.  |
| Phone Number | string | No       | Customer's phone number.  |

**Outputs**

| Field       | Type   | Description                                        |
| ----------- | ------ | -------------------------------------------------- |
| Customer ID | string | GraphQL ID of the created customer.                |
| Legacy ID   | string | Legacy (Control Panel) ID of the created customer. |
| Customer    | object | The created customer.                              |

#### Void Transaction

Void an unsettled Braintree transaction, e.g. when an order is canceled.

**Inputs**

| Field           | Type   | Required | Description                                                         |
| --------------- | ------ | -------- | ------------------------------------------------------------------- |
| Transaction ID  | string | Yes      | The unsettled transaction to void.                                  |
| Idempotency Key | string | No       | Optional idempotency key to prevent duplicate reversals on retries. |

**Outputs**

| Field         | Type   | Description                                               |
| ------------- | ------ | --------------------------------------------------------- |
| Reversal ID   | string | GraphQL ID of the voided transaction or resulting refund. |
| Reversal Type | string | 'Transaction' when voided; 'Refund' when it had settled.  |
| Status        | string | Status of the reversal (e.g. VOIDED).                     |
| Reversal      | object | The voided transaction or resulting refund.               |

#### Vault Payment Method

Store a single-use payment method in the Braintree vault for reuse.

**Inputs**

| Field             | Type   | Required | Description                                                |
| ----------------- | ------ | -------- | ---------------------------------------------------------- |
| Payment Method ID | string | Yes      | The single-use payment method to vault.                    |
| Customer ID       | string | No       | Optional customer to attach the vaulted payment method to. |

**Outputs**

| Field                     | Type   | Description                                |
| ------------------------- | ------ | ------------------------------------------ |
| Vaulted Payment Method ID | string | The permanent multi-use payment method ID. |
| Payment Method            | object | The vaulted payment method.                |

#### Create Subscription

Enroll a payment method in a Braintree recurring subscription plan.

**Inputs**

| Field                    | Type    | Required | Description                                                      |
| ------------------------ | ------- | -------- | ---------------------------------------------------------------- |
| Plan ID                  | string  | Yes      | The subscription plan to enroll the customer in.                 |
| Payment Method ID        | string  | Yes      | Single-use or vaulted payment method to bill.                    |
| Price                    | string  | No       | Optional price override; leave empty to use the plan's price.    |
| Merchant Account ID      | string  | No       | Optional merchant account for the subscription's transactions.   |
| Number of Billing Cycles | integer | No       | Optional total billing cycles; leave empty to bill indefinitely. |

**Outputs**

| Field           | Type   | Description                               |
| --------------- | ------ | ----------------------------------------- |
| Subscription ID | string | GraphQL ID of the created subscription.   |
| Status          | string | Status of the subscription (e.g. ACTIVE). |
| Subscription    | object | The created subscription.                 |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/braintree.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
