A unique Item
is created when an end-user links their bank account through Plaid. Based on how you’ve set up your integration, it might be possible for an end-user to create multiple Item
s for the same set of online banking credentials. Depending on your application’s use case, you may want to prevent an end-user from creating multiple Item
s. Below are some reasons why you might want to prevent that:
- Development environment: exhausting all of your 100 live credentials may result in an
ADDITION_LIMIT
error. - Billed for duplicate
Item
s: if an end-user has already linked their bank account and created anItem
in your application, you may not want the same end-user to create a newItem
because this can affect your billable usage in Production.
Every application serves a different purpose, so please consider what is necessary for your use case - below are some suggestions for how you may implement this logic in your application:
User Login
Position the Plaid Link flow behind your application’s user-login. This enables you to store information about which bank(s) your user has already connected via Plaid Link.
onSuccess()
callback
You can detect whether an incoming end-user is creating a duplicate Item
by leveraging the onSuccess()
callback. The onSuccess()
callback will contain bank account metadata that you can use to verify whether the end-user has already connected to your application. You can use the account information in onSuccess()
’s metadata to validate whether the end-user has already connected the relevant accounts. Specifically, you can compare a combination of the accounts’ institution_id
, account name
, and account mask
to determine whether your end-user has previously linked their account to your application. Other fields found within the Account schema may also be useful to your integration.
In the Production environment, an Item
will not been created until you have exchanged the public_token
from the onSuccess()
callback for an access_token
. A billing event is only initiated once you have successfully completed the Exchange Token flow for an access_token
.
In the Development environment, your Live Credentials count will decrement every time a public_token
is created.
Plaid Pattern
The Plaid Pattern example application has implemented server logic that checks whether the user ID and institution ID pair already exist in the application database - you may examine the example source code here.