Add a bank funding source

Dwolla.js to create a funding source

Using dwolla.js, securely transmit sensitive data (bank account and routing number) to Dwolla without the data passing through your server. This resource guide will walk you through the process of generating a funding sources token, collecting the user’s bank account information, and calling a JavaScript function to send this data to Dwolla. When you collect and submit the user’s bank account information, dwolla.js has built-in validation that will trigger an error if any of the required fields are invalid.


funding-sources-tokenstringA funding sources token generated on your server.
paramsobjectAn object containing params to create a funding source. Contains keys: routingNumber, accountNumber, type, and name. See example below.
routingNumber represents a string value nine digit routing number.
accountNumber represents a string value account number.
type represents a string value of either checking or savings.
name represents a string value identifying name of the user’s bank.
callbackfunctionA callback function that handles the response from Dwolla.


dwolla.fundingSources.create('1zN400zyPUobbdmeNfhTGH2Jh5JkFREJa9YBI8SLXp0ERXNTMT', {
  routingNumber: getVal('routingNumber'),
  accountNumber: getVal('accountNumber'),
  type: getVal('type'),
  name: getVal('name')
}, function(err, res) {
  console.log('Error: ' + JSON.stringify(err) + ' -- Response: ' + JSON.stringify(res));

Step 1: Generate a funding sources token

Before calling a function within dwolla.js to add a new funding source, you need to generate a funding sources token. Your server initiates a POST request to Dwolla, specifying for which Dwolla account or Dwolla API Customer you want to add a bank account. Dwolla will respond with a funding sources token that expires in an hour. This token will be sent to the client and used to authenticate the HTTP request asking Dwolla to add a new funding source.

curl -X POST
\ -H "Content-Type: application/vnd.dwolla.v1.hal+json"
\ -H "Accept: application/vnd.dwolla.v1.hal+json"
\ -H "Authorization: Bearer qe634nV7dIYpYDf3VGZPciziPU2BCboUZ7G7EG8XEyGswKkBV5"
\ ""

HTTP/1.1 200 OK
  "_links": {
    "self": {
      "href": ""
  "token": "Z9BvpNuSrsI7Ke1mcGmTT0EpwW34GSmDaYP09frCpeWdq46JUg"
customer_url = ''

# Using DwollaV2 - (Recommended)
customer = "#{customer_url}/funding-sources-token"
customer.token # => "Z9BvpNuSrsI7Ke1mcGmTT0EpwW34GSmDaYP09frCpeWdq46JUg"
// Using dwolla-v2 -
var customerUrl = '';

  .then(function(res) {
    res.body.token; // => 'Z9BvpNuSrsI7Ke1mcGmTT0EpwW34GSmDaYP09frCpeWdq46JUg'
customer_url = ''
customers_api = dwollaswagger.CustomersApi(client)

token = customers_api.create_funding_sources_token_for_customer(customer_url)
print token['token'] # => 'Z9BvpNuSrsI7Ke1mcGmTT0EpwW34GSmDaYP09frCpeWdq46JUg'
$customersApi = new DwollaSwagger\CustomersApi($apiClient);

$fsToken = $customersApi->createFundingSourcesTokenForCustomer("");
$fsToken->token; # => "Z9BvpNuSrsI7Ke1mcGmTT0EpwW34GSmDaYP09frCpeWdq46JUg"

Step 2: Add form to collect bank account information

You’ll then add a form to the body of the page where you want to collect the user’s bank account information.

    <label>Routing number</label>
    <input type="text" id="routingNumber" placeholder="273222226" />
    <label>Account number</label>
    <input type="text" id="accountNumber" placeholder="Account number" />
    <label>Bank account name</label>
    <input type="text" id="name" placeholder="Name" />
    <select name="type" id="type">
      <option value="checking">Checking</option>
      <option value="savings">Savings</option>
    <input type="submit" value="Add Bank">

<div id="logs">

Step 3: Configure and call JavaScript function to create a new funding source

Assuming dwolla.js is already included and configured on your page, you will create the function that will call dwolla.fundingSources.create(). For this example, jQuery is used to call the function that creates a funding source when the user clicks the “Add Bank” button on your page. To test in the sandbox environment, use the dwolla.configure() helper function and pass in the value of sandbox.

In our example, dwolla.fundingSources.create() takes three arguments: a string value of the funding sources token, JavaScript object containing bank account information entered by the user, and a callback function that will handle any error or response.

$('form').on('submit', function() {
  var token = 'Z9BvpNuSrsI7Ke1mcGmTT0EpwW34GSmDaYP09frCpeWdq46JUg';
  var bankInfo = {
    routingNumber: $('routingNumber').val(),
    accountNumber: $('accountNumber').val(),
    type: $('type').val(),
    name: $('name').val()
  dwolla.fundingSources.create(token, bankInfo, callback);
  return false;

function callback(err, res) {
  var $div = $('<div />');
  var logValue = {
    error: err,
    response: res

Step 4: Callback function - handling the error or response

The callback function (err, res) allows you to determine if there is an error with the request (e.g. Routing number invalid.) or if the response was successful. In the example above, we are displaying any error or response within a logs container on our page.

  • If there is an error: Display the error to the user to have them correct any fields, and have them re-attempt to add their bank.
    • Example: {"error":{"code":"ValidationError","message":"Validation error(s) present. See embedded errors list for more details.","_embedded":{"errors":[{"code":"Invalid","message":"Routing number invalid.","path":"/routingNumber"}]}}}
  • If successful: You will receive a JSON response that includes a link to the newly attached funding source.
    • Example: {"error":null,"response":{"_links":{"funding-source":{"href":""}}}}


Production: Operational

Financial institutions play an important role in the Dwolla network.

Dwolla, Inc. is an agent of Veridian Credit Union and all funds associated with your account in our network are held in one or more pooled accounts at Veridian Credit Union. These funds may not be eligible for share insurance by the National Credit Union Share Insurance Fund. Dwolla, Inc. is the operator of a software platform that communicates user instructions for funds transfers to Veridian Credit Union.