I implemented worldpay on my onepage angular app (angular 1.x). Im using useTemplateForm() method to generate credit card form and retrive token. Everything is working fine, except that my callback function (that is set in useTemplateForm) is called multiple times after retriving token.
This is due to calling useTemplateForm every time payments window pops up. Worldpay.js somehow stacks those callbacks instead of clearing them and i have no idea how to prevent it. I have to call useTemplateForm every time window pops up cos the element (div) that contains iframe is destroyed every time payment window closes. Destroying this element doesnt reset stacked callbacks tho.
I can handle this in different ways, but id rather use some method to prevent stacking infinite amount of callbacks cos at the end it will just consume unnecessary resources.
Anyone got any idea how to "fix" this ?