Errors When Adding Bank Funding Sources in Sandbox

Hello,

I am testing out Dwolla in sandbox mode and have successfully created a verified customer. I now am trying to test out adding a Bank Funding Source to that customer.

I am using the guide here for my code:

However, when I run the form, I get this message even if I put real bank information:

{"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"},{"code":"Invalid","message":"Account number invalid.","path":"/accountNumber"},{"code":"Invalid","message":"Type invalid.","path":"/type"},{"code":"Invalid","message":"Name invalid.","path":"/name"}]}}}

Do the values need to be certain test values since it is in sandbox mode?

Thank you

Hi @Matt_J !

I personally try to shy away from using real bank account information in the sandbox, but I can definitely help.

  1. Make sure that both the routing and account numbers are US Valid. The Dwolla API handles high level validation of those fields. Validation of the account number checks to see if the string passed in is between 4-17 characters (alphanumeric). Validation of the routing number includes: a checksum, length must be 9 digits, and the first two numbers are checked to be in a certain range.

You can use the same numbers found in our Postman collection for this endpoint to test
"routingNumber": "222222226"
"accountNumber": "123456789"

  1. If you are using real bank information certain accounts (like money market accounts) do not allow for ACH debit or creditsPlease let me know if this helped or if you are still experiencing and error. You can also include a snippet of your code.

Thank you for your reply. Using the numbers found in the Postman collection resulted in the same errors. Here is the code I am using:

Relevant head section:
<script src="https://cdn.dwolla.com/1/dwolla.js"></script>

Relevant body section:

<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/dwolla/DwollaSwagger.php');

//ACCESS TOKEN
$params = array(
	'client_id' => 'REMOVED',
	'client_secret' => 'REMOVED',
	'grant_type' => 'client_credentials'
);
$token = json_decode(func_quick_curl('https://api-sandbox.dwolla.com/token', '', $params))->access_token;
DwollaSwagger\Configuration::$access_token = $token;

$apiClient = new DwollaSwagger\ApiClient("https://api-sandbox.dwolla.com");

$customer = "https://dashboard-sandbox.dwolla.com/customers/1a775f3b-12c8-4325-b53a-c4fb9082df33";
?>

<!-- ADD BANK ACCOUNT -->
<form>
  <div>
	<label>Routing number</label>
	<input type="text" id="routingNumber" value="222222226" />
  </div>
  <div>
	<label>Account number</label>
	<input type="text" id="accountNumber" placeholder="Account number" value="123456789" />
  </div>
  <div>
	<label>Bank account name</label>
	<input type="text" id="name" placeholder="Name" value="Capital One" />
  </div>
  <div>
	<select name="type" id="type">
	  <option value="checking">Checking</option>
	  <option value="savings">Savings</option>
	</select>
  </div>
  <div>
	<input type="submit" value="Add Bank" />
  </div>
</form>

<div id="logs"></div>

<?php
$customersApi = new DwollaSwagger\CustomersApi($apiClient);

$fsToken = $customersApi->createFundingSourcesTokenForCustomer($customer);
?>

<script>
// Sandbox
dwolla.configure("sandbox");
//dwolla.configure("prod");


dwolla.fundingSources.create(
  "<?php echo $fsToken->token;?>",
  {
	routingNumber: $("routingNumber").val(),
	accountNumber: $("accountNumber").val(),
	type: $("type").val(),
	name: $("name").val(),
  },
  function (err, res) {
	console.log(
	  "Error: " + JSON.stringify(err) + " -- Response: " + JSON.stringify(res)
	);
  }
);


$("form").on("submit", function () {
  dwolla.configure("sandbox");
  var token = "<?php echo $fsToken->token;?>";
  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,
  };
  $div.text(JSON.stringify(logValue));
  console.log(logValue);
  $("#logs").html($div);
}
</script>

Thank you for your assistance.