tinkoff.methods.on(tinkoff.constants.SUCCESS, onMessage); tinkoff.methods.on(tinkoff.constants.REJECT, onMessage); tinkoff.methods.on(tinkoff.constants.CANCEL, onMessage); function onMessage(data) { switch (data.type) { case tinkoff.constants.SUCCESS: console.log('SUCCESS', data.meta.iframe.url); break; case tinkoff.constants.REJECT: console.log('REJECT', data.meta.iframe.url); break; case tinkoff.constants.CANCEL: console.log('CANCEL', data.meta.iframe.url); break; default: return; } tinkoff.methods.off(tinkoff.constants.SUCCESS, onMessage); tinkoff.methods.off(tinkoff.constants.REJECT, onMessage); tinkoff.methods.off(tinkoff.constants.CANCEL, onMessage); data.meta.iframe.destroy(); }