Plaid Link

Plaid Link allows users to quickly verify bank accounts through instant account verification (IAV). If Moov is managing your Plaid relationship, you can use Moov.js to link bank accounts with Plaid.

Please coordinate with Moov support to prepare your account for Plaid.

Initialize Moov.js

As with all Moov.js methods, you will need a Moov access token with the appropriate scopes.

The Moov.js Plaid functions require the following scopes:

  • /accounts/{accountID}/bank-accounts.write
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<head>
  <script src="https://js.moov.io/v1"></script>
</head>
<body>
  <script>
    fetch( ... ) // Use your server to get a Moov access token with the appropriate scopes
    .then((moovAccessToken) => {
      const moov = Moov(moovAccessToken);
      moov.plaid.initialize( ... );
    });
  </script>
</body>

Initialize a connection to Plaid, allowing users to instantly verify and link bank accounts to an existing Moov account. Note: For Moov-managed Plaid integrations only.

Parameters

Name Type Description
accountID UUID string ID for an existing, connected, Moov account
env "sandbox" or undefined Plaid environment. Use "sandbox" for testing. Use undefined for production.
elementID string Optional. If provided, Plaid flow will open when the DOM element with this ID is clicked.
redirectURL URL string If Plaid forces the user to a bank’s website, they will eventually return to this url. Must be a webpage on your current domain. Contact Moov Support to register this url in the Plaid dashboard.
onSuccess (moovBankAccount) => void Optional. Callback function executed when Plaid successfully links a bank account to Moov. Moov bank account object is passed as a parameter.
onExit (err, metadata) => void Optional. Callback function executed when the user exits the Plaid flow.
onEvent (eventName, metadata) => void Optional. Callback function executed on each Plaid event.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
moov.plaid.initialize({
  accountID: "your-connected-account-id",
  env: "sandbox",
  elementID: "your-plaid-button-id",
  redirectURL: "https://yoursite.com/plaidredirecturl",
  onSuccess: (bankAccount) => {
    console.log("Success! Moov bank account: ", bankAccount);
  },
  onExit: (err, metadata) => {
    console.log("Plaid flow exited: ", err);
  },
  onEvent: (eventName, metadata) => {
    console.log("Plaid event emitted: ", eventName);
  }
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
moov.plaid.initialize({
  accountID: "your-connected-account-id",
  env: "sandbox",
  redirectURL: "https://yoursite.com/plaidredirecturl",
  onSuccess: (bankAccount) => {
    console.log("Success! Moov bank account: ", bankAccount);
  },
  onExit: (err, metadata) => {
    console.log("Plaid flow exited: ", err);
  },
  onEvent: (eventName, metadata) => {
    console.log("Plaid event emitted: ", eventName);
  }
}).then((plaidHandler) => {
  plaidHandler.open();
});

Reinitialize Plaid (Oauth redirects)

Some banks use an OAuth flow to connect to Plaid. In these situations, your user will be redirected to the bank’s website to authenticate, and then redirected back to your specified redirectURL. This redirect landing page must run moov.plaid.reinitialize to resume the Plaid flow.

Parameters

Name Type Description
receivedRedirectUri URL string URL of the current page. Will be a combination of your redirectURL and query parameters set by Plaid.
accountID UUID string ID for an existing, connected, Moov account
env "sandbox" or undefined Plaid environment. Use "sandbox" for testing. Use undefined for production.
elementID string Optional. If provided, Plaid flow will open when the DOM element with this ID is clicked.
onSuccess (moovBankAccount) => void Optional. Callback function executed when Plaid successfully links a bank account to Moov. Moov bank account object is passed as a parameter.
onExit (err, metadata) => void Optional. Callback function executed when the user exits the Plaid flow.
onEvent (eventName, metadata) => void Optional. Callback function executed on each Plaid event.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
moov.plaid.reinitialize({
  accountID: "your-connected-account-id",
  receivedRedirectUri: window.location.href,
  env: "sandbox",
  onSuccess: (bankAccount) => {
    console.log("Success! Moov bank account: ", bankAccount);
  },
  onExit: (err, metadata) => {
    console.log("Plaid flow exited: ", err);
  },
  onEvent: (eventName, metadata) => {
    console.log("Plaid event emitted: ", eventName);
  }
});

Using Plaid Sandbox

For testing purposes, you can use the env: "sandbox" setting in your Plaid configuration object. In Plaid’s sandbox environment, you can find test bank accounts by searching for Platypus. For all Platypus bank accounts, the username is user_good and the password is pass_good.

tip
Duplicate accounts: There is an ongoing issue with Plaid’s sandbox environment, where OAuth Platypus banks may throw a duplicate account error at the end of the Plaid Link flow. Unfortunately, this issue is outside of Moov’s control. This issue is limited to Plaid’s sandbox environment, and should not affect users in production.