Plaid Integration

Instantly verify bank accounts and aggregate held away account data



Back to Integrations



Plaid enables applications to connect with users’ bank, credit card, loan, and investment accounts to pull in account details such as balances and transactions. The same connection can also be used to verify ownership of an account (IAV).

Setup

To get started, you’ll first need to sign up for Plaid and get your client_id, public_key, and secret (which differs per environment). If you already have a Plaid account, you can go ahead and sign in to retrieve these values. We currently support Plaid Development and Production environments, not Sandbox (dummy accounts).

Implementation

Once you have Plaid credentials set up on the Integrations Admin, you can embed Plaid Link into your app or web page. The Plaid Link will manage user credential validation, multi-factor authentication, and error handling for each institution that Plaid supports to ensure that your end-user is able to pull data from the account that they’ve linked.

Below is a sample Plaid link embed code. In the onSuccess below, we are calling our Integration API and exchanging the public token for the account details. Our server will do the exchange and store the mapping of the Plaid ID to Hydrogen.


<button id="link-button">Link Account</button>
<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script type="text/javascript">
(function($) {
  var handler = Plaid.create({
    clientName: '<APP NAME>',
    env: 'development',
    key: '<PLAID PUBLIC KEY>',
    product: ['auth', 'transactions'],
    onLoad: function() {
      // Optional, called when Link loads
    },
    onSuccess: function(public_token, metadata) {
      $.post('https://sandbox.hydrogenplatform.com/integration/v1/token_exchange', {
          nucleus_client_id: '<nucleus_client_id>', 
          product: 'atom',
          integration_type: 'aggregation',
          vendor_name: 'plaid',
          vendor_request: { 
            metadata: metadata,
            public_token: public_token
          }
      });
    },
  });

  $('#link-button').on('click', function(e) {
    handler.open();
  });
})(jQuery);
</script>

Now we just have to create the aggregation account to store all the data in Nucleus with the <item_id> from the response above.

POST /integration/v1/aggregation/account


{
    "nucleus_client_id": "<nucleus_client_id from URL>",
    "product": "atom",
    "vendor_request": {
        "item_id": "<item_id from Plaid token exchange response>"
    }
}