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

# Bank Transactions - Plaid

Layer leverages [Plaid](https://plaid.com/) to connect with your customers' accounts at external financial institutions to ingest data such as transactions and balances and incorporate them into their accounting.

## Using Layer's Plaid connection

If your platform does not already have a Plaid integration, you can utilize Layer's Plaid connection to import to your customers' external bank accounts and credit card data. Layer will manage all aspects of the Plaid integration on your behalf.

To start importing customers' bank accounts and credit cards into Layer, embed Layer's *Bank Linking* react component within your product. This component manages all aspects Layer's plaid connection and walks customers through the process of granting read-only access to their bank account and credit card activity. More detail on using Layer's embedded UI components is available [here](/guides/embedded-components).

<img src="https://mintcdn.com/layerfi-beta/oeZ7JcW3yIMmNpWf/images/bank-linking-component.png?fit=max&auto=format&n=oeZ7JcW3yIMmNpWf&q=85&s=4800d2e80617d627729ef8d8b7672226" alt="Bank Linking Component" width="1156" height="243" data-path="images/bank-linking-component.png" />

Once your customers have connected their accounts, Layer will automatically start importing their bank account and credit card transactions.

## Using your own Plaid connection

If your platform already has an integration with Plaid, you can grant Layer access to your existing Plaid data through Plaid's [processor token functionality](https://plaid.com/docs/api/processors/).

### Creating processor tokens

First, [link](https://plaid.com/docs/link/#link-flow-overview) a customer's bank account with Plaid as normal, obtaining an `access_token`.

Next, use the `access_token` and the `account_id` for an account to create a processor token via Plaid's [/processor/token/create](https://plaid.com/docs/api/processors/#processortokencreate) endpoint.

```bash Request theme={null}
curl -X POST https://sandbox.plaid.com/processor/token/create \
  -H 'Content-Type: application/json' \
  -d '{
    "client_id": "PLAID_CLIENT_ID",
    "secret": "PLAID_SECRET",
    "access_token": "ACCESS_TOKEN",
    "account_id": "ACCOUNT_ID",
    "processor": "layer"
  }'
```

```json Response theme={null}
{
  "processor_token": "processor-sandbox-0asd1-a92nc",
  "request_id": "xrQNYZ7Zoh6R7gV"
}
```

### Using Processor Tokens

After creating a `processor_token` for each of the customer's accounts, [update customer's business](/api-reference/business/update) with the processor tokens to begin ingesting data from the associated accounts.

```bash Request theme={null}
curl -X PUT https://sandbox.layerfi.com/v1/businesses/863ed926-e30d-40f4-8e7e-b0d5387ce4fb \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "plaid_processor_tokens": [
      {
        "processor_token": "processor-sandbox-0asd1-a92nc"
      }
    ],
  }'

```

Note that you must include all processor tokens that you would like to have associated with the business.
Existing processor tokens not included in the request will be removed from the business. As such, you can remove all processor tokens from a business by updating it with an empty list of processor tokens.

If there is no business associated with the customer yet, you can also include processor tokens when [creating a business](/api-reference/business/create).

### Refreshing processor tokens

If the access token for a Plaid account changes, all processor tokens associated with that account are invalidated.

If this occurs, create a new processor token for the account, then [update the business](/api-reference/business/update) with the updated list of processor tokens.
If you need to see the processor tokens already associated with the business, call the [List Plaid Accounts](/api-reference/plaid-account/list-plaid-accounts) endpoint.
