@alanch wrote:
I have the following code in my ionic 2/3 app which is working fine in terms of getting the token id and showing it in the console.log.
collectCardInfo(){
this.tK = null;if (this.validate()) {
this.handler.open({
name: 'XXXXXX',
description: 'XXXXXXXXXXX',
email: xxxx,
amount: xxxxx,
token: function (token: any){
console.log("token.id: " + token.id);
}
})
} // if (valid)
}However, I seem to be missing something. After getting the token, I need to send it to my server. In my case I use a service like ( this.paymentService.postOrder(){...} ) to post the token.id, order details, and shipping info to my server. However, I can not seem to get the callback function to work. if I do this:
token: function(token:any){
this.paymentService.postOrder(){...}
}I get an error saying it can't call property postOrder of undefined. Any other function I try to call in this callback errors out saying the functionName is not a function. Nothing I have tried seems to work. I'm sure the problem is syntax with respect to how I'm trying to call it. But I'm stuck. Any help would be appreciated. Thanks!
Posts: 1
Participants: 1