Now I am switching to production. And getting “InvalidTokenType : The requested endpoint requires an account token” error while creating new customer.
'getDwollaAccount' : function(userId) {
var dwollaCredentials = getDwollaCreden();
const client = new dwolla.Client({
key : dwollaCredentials.appKey,
secret : dwollaCredentials.appSecret,
environment : 'production' // optional - defaults to production
}); // call dwolla initial api
client.auth.client()
.then(Meteor.bindEnvironment(function(appToken) {
var userFound =
Meteor.users.findOne({'_id':userId,'profile.dwollaLocation':''});
if(userFound){
var requestBody = {
firstName : userFound.profile.firstname,
lastName : userFound.profile.lastname,
email : userFound.emails[0].address
};
appToken
.post('customers', requestBody)
.then(
(res)=> {
var dwollaLocation = res.headers.get('location');;
return Promise.resolve(dwollaLocation);
}
)
.then(
Meteor.bindEnvironment((dloc) =>{
return Promise.resolve(dloc);
})
)
.catch(Meteor.bindEnvironment((error) => {
console.log(error);
}));
} // end of user found
})
);
},
Thanks in advance!