Please make sure that you are calling the initiateCard method on ngAfterViewInit. If you do so and still getting this error please place a breakpoint at the line which creates the token. Make sure that card attribute is not undefined. The error message looks pretty obvious actually, I think there should be something wrong in your card initialization. If you try to initialize the card before the html is rendered than you would end up in a situation like this. I hope this helps, if you need any further help please let me know. Thanks!