Stripe & Plaid Node Integration

If you are trying to get Stripe and Plaid to work for your ACH verification, I have a few pointers and some code you can checkout.

Tl;dr: https://github.com/Threde/stripe-plaid-ui
This code assumes you’ve already made your customer’s account on stripe’s back-end. And that you are passing the the param ‘customer’ in the hosted url.
ex: https:localhost.com/?customer=cus_ANjLfuBWFXthGb

Stripe & Plaid Documentation

When I had to build a payment portal for Threde, I discovered trying to hookup Plaid with Stripe wasn’t as simple as I might have thought. I truly thought it was as simple as getting the right keys and I would be good to go, but that’s not the case.

To start off, you want to obviously get a stripe and plaid account. On the plaid side, you will need to hook it up to your stripe account. After doing so, if you are like me ( a small startup), to get the plaid access, I suggest you email them directly to get in. We, at Threde, don’t do a lot of ACH transactions so it didn’t make sense for us to do a monthly payment thingy. So by emailing them and asking if they have something for us, they upgraded our account. Thanks Plaid! 😀

But yeah, after you get the keys, I discovered that the documentation wasn’t very straight forward on Plaid’s side. For Stripe, it wasn’t straight forward on how to get the right token for a transaction for Plaid. After hours of digging, I was finally able to figure out how to really hook the two up.

So, there are two parts to this that you need to do. You have to make an api that can talk to stripe & plaid api at the same time and you have to have the plaid-link with the correct version of stripe on the client-side.

for the server-side, code go here:
https://github.com/Threde/stripe-plaid-ui/blob/master/index.js

for the client-side code, go here:
https://github.com/Threde/stripe-plaid-ui/blob/master/views/index.ejs

( don’t judge, I know it’s shit but I haven’t had time to clean it)

here’s the step process:

  1. get customer’s id & info from the url param ‘customer’ and save that as a global on the server-side via /get_customer_info
  2. customer clicks on plaid-link and we send the plaid token to the server-side to get the bank access token via /get_access_token
  3. customer clicks on verify to verify the bank account to link to the ‘customer’ id on the server-side via /verify_bank
  4. customer adds the bank account via stripe’s client on the server-side.

The important thing about this process, that wasn’t mentioned clearly in the documentation in stripe or plaid, is that you have to use the plaid access token + account id to get the stripe bank account token….sounds confusing but in a gist, what I am trying to say is you use the plaid access token inside of plaid’s createProcessorToken(ACCESS_TOKEN, ACCOUNT_ID) to get the stripe bank account token for using stripe’s
stripe.customers.createSource(CUSTOMER_ID, { source: STRIPE_BANK_ACCOUNT_TOKEN})

The README file has links to all the docs. Also, I left comments with some links in the code to explain where to find the documentation for the different methods from Stripe and Plaid.

Anyhoo, if you have questions let me know.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s