Remove the HelcimPay.js iFrame

Once a payment has been processed through HelcimPay.js, you will want to destroy the iFrame so that your customers can continue to interact with your system that was underneath the iFrame element.

To destroy the iFrame, you can call the following HelcimPay.js function. You do not need to pass any parameters to the function, but you will need an element with the same id.

// remove HelcimPay iFrame function
function removeHelcimPayIframe() {
  
 const frame : HTMLElement = document.getElementById(elementId: 'helcimPayIframe');
  
  if(frame instanceof HTMLIframeElement) {
  	frame.remove();
    window.removeEventListener(type: 'message', watchForExit, options: false);
	}
  
}