Catching the end of payment

For integrations including return within the iframe (FORM_TARGET=_self), it is requires to close the iframe, and to display the payment result on the parent frame.

To do this, you can declare the following JS function in the parent frame:

window.removeIframe = function() {
	var iframe = document.querySelector('iframe[name=payment]');
	if (iframe) {
		iframe.remove();
	}
};			

And below the code to call the function, to place in your return pages:

<script>
	parent.removeIframe();
</script>