> ## Documentation Index
> Fetch the complete documentation index at: https://docs.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 your customers' external bank accounts and credit card data. Layer will manage all aspects of the Plaid integration on your behalf.

## 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/).

***

<Tabs>
  <Tab title="Using Layer's Plaid Connection">
    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 of 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/layerfinancialtechnologiesinc/0_c_qPO4Af3kMlwQ/images/bank-linking-component.png?fit=max&auto=format&n=0_c_qPO4Af3kMlwQ&q=85&s=bbeeffc3a8681a77cfbc3446d28abc96" 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.
  </Tab>

  <Tab title="Using Your Own Plaid Connection">
    ### 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 the 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 you would like associated with the business. Existing processor tokens not included in the request will be removed. You can remove all processor tokens from a business by updating it with an empty list.

    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.
  </Tab>
</Tabs>
