Layer leverages Plaid 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.

Bank Linking Component

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.

Creating processor tokens

First, link 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 endpoint.

Request
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"
  }'
Response
{
  "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 with the processor tokens to begin ingesting data from the associated accounts.

Request
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.

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 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 endpoint.