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
Items 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
Items. Below are some reasons why you might want to prevent that:
- Development environment: exhausting all of your 100 live credentials may result in an
- Billed for duplicate
Items: if an end-user has already linked their bank account and created an
Itemin your application, you may not want the same end-user to create a new
Itembecause 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:
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.
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’
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.
It is important to note that the
Item has 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
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.