Stripe ACH + Plaid + Rails

Stripe ACH processes large volumes of credit and debit transactions. Its also connected with plaid for instant verification of bank account. You can directly charge on customer once it’s verified. Here I’ve explained on how to integrate it with ruby.

Plaid and Stripe have partnered to offer frictionless money transfers without the need to ever handle an account or routing number. Use Plaid Link to instantly authenticate your customer’s account and automatically generate a Stripe bank account token so that you can accept ACH payments via their ACH API.

Step 1. Setup Strip and Plaid

First you need setup stripe and plaid . If not please use following links


Then you need to activate ACH Access. If you see following link in ACH Guide after sign up, Click ‘Accept Terms of Service’ to enable your Stripe account for ACH


To verify that your Plaid account is enabled for the integration, go to the account dashboard. If you see:


Click the ‘Connect With Stripe’  and follow the steps. If you did not connect to your stripe to plaid you can’t get stripe bank token.

Once your Stripe account is connected, you’ll see:

Your Plaid account is now set up for the integration!


Step 2: Integrate with Plaid Link

Once your Plaid account is setup and connected to your Stripe account, add Plaid Link to your site.

<button id='linkButton'> Open Plaid Link< /button>
<script src=" /link/stable/link-initialize. js"> < /script>
var linkHandler = Plaid.create({
  env: 'tartan',
  clientName: 'Stripe / Plaid Test',
  key: '[Plaid key]',
  product: 'auth',
  selectAccount: true,
  onSuccess: function(public_token, metadata) {
    // Send the public_token and account ID to your app server.
    console.log('public_token: ' + public_token);
    console.log('account ID: ' + metadata.account_id);
// Trigger the Link UI
document.getElementById ('linkButton').onclick = function() {;

Step 3: Integrate with rails using plaid-ruby library

Include plaid-ruby in your gem file and configure plaid in config/application.rb

Plaid.config do |p|
  p.customer_id = 'Plaid provided customer ID here'
  p.secret = 'Plaid provided secret key here'
  p.environment_location = 'URL for the development or production environment'
  # i.e. '' for development, or
  # '' for production

Step 4: Integrate With Stripe ACH

With Stripe, you can accept ACH payments in nearly the same way as you accept credit card payments, merely providing a verified bank account as the source argument for a charge request. However, accepting bank accounts requires a slightly different initial workflow than accepting credit cards:

1. Bank accounts must first be verified.

2. Bank accounts must be authorized for your use by the customer.

Plaid provides the quickest way to collect and verify your customer’s banking information. Using the Stripe + Plaid integration, you’re able to instantly receive a verified bank account, allowing for immediate charging.

To get stripe bank token you request plaid with

exchangeTokenResponse = Plaid.exchange_token( public_token, account_id)

it will return following details

  "sandbox": false,
  "access_token": "[Plaid API access token]",
  "stripe_bank_account_token": “[Stripe Bank Token]”,
  "account_id": "[Plaid Account ID]"

You can attach this token to a Stripe Customer object, or create a charge directly on it.

Stripe.api_key = “stripe_secret_key”
customer = Stripe::Customer.create(
:email =>’email’,
:description => “description",
:source => exchangeTokenResponse. stripe_bank_account_token)

You can use this customer object to charge

Stripe.api_key = “stripe token"
  :amount   => 1500,
  :currency => "usd",
  :customer => customer_id

You can use this token for linking bank account to stripe account. But the stripe bank valid for one time usage. Request once again to get exchangeTokenResponse and link your bank to stripe.

stripe_account = Stripe::Account.retrieve (‘Connected Account id’)
stripe_account.external_accounts. create(
:external_account => exchangeTokenResponse. stripe_bank_account_token)

This will create bank account for connected stripe account

Hope this is helpful..

ROR Developer,
Mallow Technologies.

Leave a Comment

Your email address will not be published. Required fields are marked *