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.