Add Dwolla to your app
Use Dwolla with Plaid Auth to send and receive payments
Plaid and Dwolla have partnered to offer businesses an easier way to connect to the U.S. banking system. Plaid enables businesses to instantly authenticate a customer's bank account, giving them the ability to leverage the Dwolla API to connect to the ACH or RTP® networks for sending and receiving payments. Dwolla’s solution offers frictionless ACH or real-time payments payments for companies looking to automate their current payments process and scale their business.
With the Plaid + Dwolla integration, your users can verify their accounts in seconds by inputting their banking credentials in Plaid’s front-end module. Plaid’s mobile-friendly module handles input validation, error handling, and multi-factor authentication–providing a seamless onboarding experience to convert more users for your business.
As part of the integration, Dwolla customers can access Plaid’s full suite of APIs for clean, categorized transaction data, real-time balances, and more.
Getting started
You'll first want to familiarize yourself with Plaid Link, a drop-in client-side integration for the Plaid API that handles input validation, error handling, and multi-factor authentication.
Your customers will use Link to authenticate with their financial institution and select the depository account they wish to use for ACH or RTP® transactions. From there, you'll receive a Plaid access_token
, allowing you to leverage real-time balance checks and transaction data, and a Dwolla processor_token
, which allows you to quickly and securely verify a bank funding source via Dwolla's API without having to store any sensitive banking information. Utilizing Plaid + Dwolla enables a seamless workflow for sending and receiving payments.
Instructions
Set up your Plaid and Dwolla accounts
You'll need accounts at both Plaid and Dwolla in order to use the Plaid + Dwolla integration. You'll also need to be a Dwolla customer in order to add a bank funding source.
First, sign up for a Dwolla account if you don't already have one.
Next, verify that your Plaid account is enabled for the integration. If you do not have a Plaid account, create one. Your account will be automatically enabled for integration access.
To verify that your Plaid account is enabled for the integration, go to the Integrations section of the account dashboard. If the integration is off, simply click the 'Enable' button for Dwolla to enable the integration.
Use the Dwolla Sandbox to test the Plaid + Dwolla integration for free.
Complete your Plaid application profile and company profile
After connecting your Plaid and Dwolla accounts, you'll need to complete your Plaid application profile and company profile in the Dashboard, which involves filling out basic information about your app, such as your company name and website. This step helps your end-users learn more how your product uses their bank information and is also required for connecting to some banks.
Create a link_token
In order to integrate with Plaid Link, you will first need to create a link_token
. A link_token
is a short-lived, one-time use token that is used to authenticate your app with Link. To create one,
make a /link/token/create
request with your client_id
, secret
, and a few other
required parameters from your app server. View the /link/token/create
documentation for a full list of link_token
configurations.
To see your client_id
and secret
, visit the Plaid Dashboard.
1app.post('/api/create_link_token', async function (request, response) {2 // Get the client_user_id by searching for the current user3 const user = await User.find(...);4 const clientUserId = user.id;5 const request = {6 user: {7 // This should correspond to a unique id for the current user.8 client_user_id: clientUserId,9 },10 client_name: 'Plaid Test App',11 products: ['auth'],12 language: 'en',13 webhook: 'https://webhook.example.com',14 redirect_uri: 'https://domainname.com/oauth-page.html',15 country_codes: ['US'],16 };17 try {18 const createTokenResponse = await client.linkTokenCreate(request);19 response.json(createTokenResponse.data);20 } catch (error) {21 // handle error22 }23});
Integrate with Plaid Link
Once you have a link_token
, all it takes is a few lines of client-side JavaScript to launch Link.
Then, in the onSuccess
callback, you can call a simple server-side handler to exchange the Link public_token
for a Plaid access_token
and a Dwolla processor_token
.
1<button id="linkButton">Open Link - Institution Select</button>2<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>3<script>4 (async function(){5 var linkHandler = Plaid.create({6 // Make a request to your server to fetch a new link_token.7 token: (await $.post('/create_link_token')).link_token,8 onLoad: function() {9 // The Link module finished loading.10 },11 onSuccess: function(public_token, metadata) {12 // The onSuccess function is called when the user has13 // successfully authenticated and selected an account to14 // use.15 //16 // When called, you will send the public_token and the selected accounts,17 // metadata.accounts, to your backend app server.1819 sendDataToBackendServer({20 public_token: public_token,21 accounts: metadata.accounts22 });23 },24 console.log('Public Token: ' + public_token);25 console.log('Customer-selected account ID: ' + metadata.account_id);26 },27 onExit: function(err, metadata) {28 // The user exited the Link flow.29 if (err != null) {30 // The user encountered a Plaid API error31 // prior to exiting.32 }33 // metadata contains information about the institution34 // that the user selected and the most recent35 // API request IDs.36 // Storing this information can be helpful for support.37 },38 });39 })();4041 // Trigger the authentication view42 document.getElementById('linkButton').onclick = function() {43 linkHandler.open();44 };45</script>
See the Link parameter reference for complete documentation on possible configurations.
Plaid.create
accepts one argument, a configuration Object
, and returns an Object
with three functions, open
, exit
, and destroy
. Calling open
will display the "Institution Select" view, calling exit
will close Link, and calling destroy
will clean up the iframe.
Write server-side handler
The Link module handles the entire onboarding flow securely and quickly, but does not actually retrieve account data for a user. Instead, the Link module returns a public_token
and an accounts
array, which is a property on the metadata
object, via the onSuccess
callback. Exchange this public_token
for a Plaid access_token
using the /item/public_token/exchange
API endpoint.
The accounts
array will contain information about bank accounts associated with the credentials entered by the user, and may contain multiple accounts if the user has more than one bank account at the institution. In order to avoid any confusion about which account your user wishes to use with Dwolla, it is recommended to set Account Select to "enabled for one account" in the Plaid Dashboard. When this setting is selected, the accounts
array will always contain exactly one account.
Once you have identified the account you will use, you will send the account_id
property of the account to Plaid, along with the access_token
, to create a Dwolla processor_token
. You'll send this token to Dwolla and they will use it to securely retrieve account and routing numbers from Plaid.
1const {2 Configuration,3 PlaidApi,4 PlaidEnvironments,5 ProcessorTokenCreateRequest,6} = require('plaid');7// Change sandbox to production when you're ready to go live!8const configuration = new Configuration({9 basePath: PlaidEnvironments[process.env.PLAID_ENV],10 baseOptions: {11 headers: {12 'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID,13 'PLAID-SECRET': process.env.PLAID_SECRET,14 'Plaid-Version': '2020-09-14',15 },16 },17});1819const plaidClient = new PlaidApi(configuration);2021try {22 // Exchange the public_token from Plaid Link for an access token.23 const tokenResponse = await plaidClient.itemPublicTokenExchange({24 public_token: publicToken,25 });26 const accessToken = tokenResponse.access_token;2728 // Create a processor token for a specific account id.29 const request: ProcessorTokenCreateRequest = {30 access_token: accessToken,31 account_id: accountID,32 processor: 'dwolla',33 };34 const processorTokenResponse = await plaidClient.processorTokenCreate(35 request,36 );37 const processorToken = processorTokenResponse.processor_token;38} catch (error) {39 // handle error40}
For a valid request, the API will return a JSON response similar to:
1{2 "processor_token": "processor-sandbox-0asd1-a92nc",3 "request_id": "[Unique request ID]"4}
Make a request to Dwolla
Once you've obtained the processor_token
, you'll then pass it to Dwolla as the value of the plaidToken
request parameter, along with a funding source name
, to create a funding source for a Dwolla Customer:
1POST https://api-sandbox.dwolla.com/customers/AB443D36-3757-44C1-A1B4-29727FB3111C/funding-sources2Content-Type: application/vnd.dwolla.v1.hal+json3Accept: application/vnd.dwolla.v1.hal+json4Authorization: Bearer pBA9fVDBEyYZCEsLf/wKehyh1RTpzjUj5KzIRfDi0wKTii7DqY56{7 "plaidToken": "processor-sandbox-161c86dd-d470-47e9-a741-d381c2b2cb6f",8 "name": "Jane Doe’s Checking"9}1011...1213HTTP/1.1 201 Created14Location: https://api-sandbox.dwolla.com/funding-sources/375c6781-2a17-476c-84f7-db7d2f6ffb31
Once you’ve received a successful response from the Dwolla API, you’ll use the unique funding source URL to identify the Customer’s bank when initiating ACH or RTP transfers.
Testing your Dwolla integration
You can create Dwolla processor_tokens
in Sandbox (sandbox.plaid.com, allows testing with simulated users) or Production (production.plaid.com, requires Dwolla Production credentials).
To test the integration in Sandbox mode, simply use the Plaid Sandbox credentials when launching Link with a link_token
created in the Sandbox environment.
When testing in the Sandbox, you have the option to use the /sandbox/public_token/create
endpoint instead of the end-to-end Link flow to create a public_token
. When using the /sandbox/public_token/create
-based flow, the Account Select flow will be bypassed and the accounts
array will not be populated. On Sandbox, instead of using the accounts
array, you can call /accounts/get
and test with any returned account ID associated with an account with the subtype checking
or savings
.
Get ready for production
Your account is immediately enabled for our Sandbox environment (https://sandbox.plaid.com). To move to Production, please request access from the Dashboard.
Example code in Plaid Pattern
For a real-life example of an app that incorporates the creation of processor tokens, see the Node-based Plaid Pattern Account Funding sample app. Pattern Account Funding is a sample account funding app that creates a processor token to send to your payment partner. The processor token creation code can be found in items.js.
For a tutorial walkthrough of creating a similar app with Dwolla support, see Account funding tutorial.
Support and questions
Find answers to many common integration questions and concerns—such as pricing, sandbox and test mode usage, and more, in our docs.
If you're still stuck, open a support ticket with information describing the issue that you're experiencing and we'll get back to you as soon as we can.