I am using dwolla.js in attempts to add account with IAV. When following the boilerplate code, I am getting the error “dwolla is not defined”. See my code below. Using react, how do I define dwolla on the front end? I have included the script tag in my header, but am not sure how to define the variable.
I tried const dwolla = require(‘dwolla-v2’); but get the error “dwolla.configure is not a function”.
Thanks.
const iavSubmit = async (customerURL) => {
let response = await Util.apiPost('/api/dwolla/fundingSourcesToken', { URL: customerURL });
let iavToken = response.data;
**dwolla**.configure('sandbox');
**dwolla**.Client().
dwolla.iav.start(iavToken, {
container: 'iavContainer',
stylesheets: [
'https://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext'
],
microDeposits: false,
fallbackToMicroDeposits: false
}, function (err, res) {
console.log('Error: ' + JSON.stringify(err) + ' -- Response: ' + JSON.stringify(res));
});
}