Reputation: 457
When I'm trying to make request with Chargebee I'm getting an error
TypeError: this.chargebee.subscription.list is not a function
But it's defined when I'm trying to debug it :
This is function where I'm making the request:
async test(){
return new Promise((resolve, reject) => {
this.chargebee.subscription.list({
limit: 2,
"plan_id[in]": ["basic", "no_trial"]
}).request(function (error, result) {
if (error) {
//handle error
console.log(error);
} else {
resolve(result)
for (var i = 0; i < result.list.length; i++) {
var entry = result.list[i]
console.log(entry);
var subscription = entry.subscription;
var customer = entry.customer;
var card = entry.card;
}
}
});
})
}
Why we have error that function is undefined, when it is defined? Appreciate any help, Thanks!
Upvotes: 0
Views: 512
Reputation: 11080
Why we have error that function is undefined, when it is defined?
Your error isn't that the function is undefined, it's that this.chargebee.subscription.list
is not a function. Indeed, take a look at your debugging output: list = Object {request: }
- it's an object, not a function, yet you're trying to call it as a function: this.chargebee.subscription.list(...).request(...)
Upvotes: 1