Prerequisites
Before starting, you will need:- Plaid enabled for your Layer account
- The ID of the Layer business connecting an account
- A business-scoped access token
Link an account
1
Generate business scoped access token
Follow Authentication to generate an access token for the Layer business.
2
Request a Plaid Link token
When the customer chooses to connect an account, request a short-lived Link token from Layer.Layer returns the token that your frontend will pass to Plaid:Request a new Link token each time the customer starts a new linking session. Do not persist or reuse it.For an implementation example, see the
layer-react Link-token request.3
Open Plaid Link
Initialize Plaid Link with the token returned by Layer. Open the modal only after the SDK reports that it is ready:Plaid owns the credential-entry modal. Your application owns the interface that launches it and the experience shown before and after it.For an implementation example, see how
layer-react initializes and opens Plaid Link.4
Exchange the public token
Plaid calls The
onSuccess with a short-lived public token and institution metadata. Send both to Layer:institution value may be null. After a successful exchange, Layer securely stores the Plaid access token and begins importing account data.For implementation examples, see the layer-react exchange request and success handler.5
Load the connected accounts
After the exchange succeeds, call List bank accounts:A newly connected account may still be synchronizing. Poll the endpoint while any entry in
cURL
external_accounts has is_syncing set to true. As a reference, layer-react polls every five seconds and stops after 15 minutes.For implementation examples, see the layer-react bank-account request and polling configuration.6
Confirm which accounts belong to the business
Layer pauses data synchronization for accounts that require confirmation. An external account requires relevance confirmation when its If the customer uses the account for their business, call Confirm external account:If the account is not used for the business, call Exclude external account:Use the external account’s
notifications array contains:cURL
cURL
id, not the containing bank account’s id. Refetch the bank accounts after processing every selection. Confirming a relevant account allows Layer to begin synchronizing it.For implementation examples, see how layer-react identifies accounts requiring confirmation and submits confirmations and exclusions.Repair a Plaid connection
When an external account has a non-nullconnection_needs_repair_as_of value, request an update-mode Link token. Pass that external account’s connection_external_id as plaid_item_id:
cURL
link_token using the same process described above. After Plaid calls onSuccess, do not exchange the public token. Instead, ask Layer to refresh the connection status:
cURL
layer-react update-mode token request and update-mode success handling.
Handle failures
Your interface should let the customer retry each network operation independently:- If Link-token creation fails, keep the customer on your connection screen and request a new token when they retry.
- If the customer exits Plaid Link, discard the Link token.
- If the public-token exchange fails, show an error and let the customer start a new linking session.
- If account synchronization takes longer than expected, stop polling and provide a manual refresh action.