Catching the end of payment

For integrations including return within the same iframe (FORM_TARGET=_self), it is required to close the iframe and display the payment result in 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();
	}
};			

Insert the following code in your return pages to call the function:

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