Dwolla Developers Logo
Back
Guides
  • Getting Started
    Testing in the Sandbox
    Generate an OAuth Access Token
    Send Money to Users
    Receive Money from Users
    Transfer Money Between Users
    Transfer Money Me-to-Me
    Building With Drop-in Components
  • Customers
    Create a Business Verified Customer
    Create a Personal Verified Customer
  • Funding Sources
    Add a Debit Card Using Dwolla-cards.js
    Add a Bank Using Dwolla.js
    OverviewStep 1: Create a formStep 2: Create a funding sources tokenStep 3: Configure and call functionStep 4: Handle JavaScript callback
    Add a Bank Using Dwolla.js + IAV
    Verify Bank with Micro-deposits
    Add Bank via Dwolla + Plaid Integration
  • Webhooks
    Create a Webhook Subscription
API DocsOpen in new tabChangelog
Get API Keys
API DocsOpen in new tabChangelog
JavaScript
Get API Keys

Step 3: Configure and call function #

Configuration options are available for utilizing dwolla.js in both our Sandbox and production environments. Configuration of an environment should take place after you have included the dwolla.js library.

javascript
// Sandbox
dwolla.configure("sandbox");

// Production
dwolla.configure("prod");

dwolla.fundingSources.create() #

ParamTypeValuefunding-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.

Example

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

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.

javascript
$("form").on("submit", function () {
  dwolla.configure("sandbox");
  var token = "Z9BvpNuSrsI7Ke1mcGmTT0EpwW34GSmDaYP09frCpeWdq46JUg";
  var bankInfo = {
    routingNumber: document.getElementById("routingNumber").value,
    accountNumber: document.getElementById("accountNumber").value,
    type: document.getElementById("type").value,
    name: document.getElementById("name").value,
  };
  dwolla.fundingSources.create(token, bankInfo, callback);
  return false;
});

function callback(err, res) {
  var $div = $("<div />");
  var logValue = {
    error: err,
    response: res,
  };
  $div.text(JSON.stringify(logValue));
  console.log(logValue);
  $("#logs").append($div);
}

Test in the Sandbox for free today.

Use sandbox environment to test API requests.

Get API Keys
2021 All Rights Reserved

Dwolla

  • About
  • Blog
  • Pricing
  • Contact Sales
  • Terms of Service
  • Privacy Policy
Financial institutions play an important role in our network.

Dwolla, Inc. is the operator of a software platform that communicates user instructions for funds transfers to our financial institution partners.

Dwolla is an agent of Veridian Credit Union. All ACH and Wire transfers are performed by Veridian Credit Union. Your Dwolla Balance, if any, is held in one or more pooled holding accounts held by Veridian Credit Union. These funds may not be eligible for share insurance by the National Credit Union Share Insurance Fund.

Sponsorship and Settlement of Push-to-Debit payment services provided by MetaBank®, N.A.
Push-to-Debit payments are typically available within 30 minutes.

Real-Time Payments are performed by Cross River Bank, which holds funds on behalf of the Receiver of such transactions in one or more pooled custodial accounts. These funds are not subject to FDIC pass-through deposit insurance.