Preventing duplicate Items
Identify duplicate Items during Link using the onSuccess callback
Prefer to learn by watching? A video guide is available for this topic.
Duplicate Item adds
When a user links their financial institution account through Plaid, a new Item is created. Two Items created for the same set of credentials at the same institution will be considered different and not share the same
item_id. Preventing a user from accidentally linking an Item they have already linked can help avoid confusing behavior in your application and will also prevent you from potentially being billed for both Items.
Duplicate Item adds with OAuth
When working with OAuth-based institutions, or with US Bank, duplicate Items cannot be created as described in this article. Instead, adding a second Item with the same set of credentials at the same institution will immediately invalidate the first Item.
Preventing duplicate Item adds with onSuccess
First, make sure you have placed the Plaid Link drop-in behind a user login, so that you can have access to any Items already associated with the same user. Then, before requesting an
access_token, first examine the
onSuccess callback metadata and compare it to the user's existing Items. You can compare a combination of the accounts’
name, and account
mask to determine whether your user has previously linked their account to your application.
For an example implementation, see Plaid Pattern, a sample app that has implemented simple server-side logic that checks whether the user ID and institution ID pair already exist in the application database. The relevant code can be found in items.js.