Cm Dialog Auto Open While Payment Process

I am developing a payment addon. While confirming 3D payment method, I want to show a popup (auto popup) to customer.

 $view = Tygh::$app['view'];
			$html = array();
		$html[] = $view->fetch( fn_get_theme_path('[themes]/[theme]/templates', 'C') . "/addons/iyzico_payment/popup.tpl"); 
		$content = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\">
		<html xmlns=\"\">
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
		<body>".implode("\n", $html)."</body>

I put the code

in popup.tpl. But actually, I couldn't understand how it works. But this way might be incorrect.

What is the correct way.

Hi ooaykac did you solve ?

And nobody knows about this ???