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
    OverviewStep 1: Create a card funding sources tokenStep 2: Configure and call functionStep 3: Handle JavaScript callback
    Add a Bank Using Dwolla.js
    Add a Bank Using Dwolla.js + IAV
    Verify Bank with Micro-deposits
    Add Bank via Dwolla + Plaid Integration
  • Webhooks
    Working with Webhooks
CommunityOpen in new tabChangelog
Get API Keys
CommunityOpen in new tabChangelog
JavaScript
Get API Keys

Step 3: Handle JavaScript Callback #

Your customer will then add their card information, including: Full Name, Card Number, Expiration Date, CVV, and Nickname. On submission of the form, you will need to handle the error or response which is triggered by the JavaScript callback. The callback function (err, res) allows you to determine if there is an error with the request (e.g. card expiration invalid) or if the response was successful.

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 card by restarting the add a debit card flow.

Check our guide on simulating various Debit card error scenarios in Sandbox.

Common errors #

CodeMessageFastFundsIneligibleThe card is ineligible for Fast Funds.PushToCardIneligibleThe card is ineligible for push-to-card.InvalidAddressThe address is invalid.
Note: This error is thrown when the address entered is different from the one that the card was issued with. For example, if you originally used the format XXXXX:XXXX for the zip code, entering just the 5 digits into the card form will trigger this error.InvalidCardNumberThe card number is invalid.InvalidCardTypeInvalid card type. Only debit cards are supported.InvalidCvvOrExpirationThe CVV or expiration date is invalid.InvalidTokenThe token is invalid.InvalidVisaActionCodeThe card could not be verified.SuspectedFraudThe card may be lost or stolen.DuplicateResourceCard already exists.MaxNumberOfResourcesThe maximum number of cards have been added.

Example error callback #

{
  "error": {
    "code": "ValidationError",
    "message": "Validation error(s) present. See embedded errors list for more details.",
    "_embedded": {
      "errors": [
        {
          "code": "Invalid",
          "message": "Card expiration invalid.",
          "path": "/cardExpiration"
        }
      ]
    }
  }
}

Example duplicate card error

{
    "code": "DuplicateResource",
    "message": "Card already exists: id=a67d47f0-73de-4a6c-8de4-105d30aad395",
    "_links": {
        "about": {
            "href": "",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "funding-source"
        }
    }
}

Example max card error

{
    "code": "MaxNumberOfResources",
    "message": "The maximum number of cards have been added.",
}

If successful, you will receive a JSON response that includes a link to the newly attached funding source.

Example success callback #

{
  "error": null,
  "response": {
    "_links": {
      "funding-source": {
        "href": "https://api-sandbox.dwolla.com/funding-sources/746d5c93-acb9-4826-a9c1-78ecf16401a6"
      }
    }
  }
}

Test in the Sandbox for free today.

Use sandbox environment to test API requests.

Get API Keys
2022 All Rights Reserved

Dwolla

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

All funds transfers made using the Dwolla Platform are performed by a financial institution partner, and any funds held in a Dwolla Balance are held by a financial institution partner. Learn more about our financial institution partners.