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\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
		<html xmlns=\"http://www.w3.org/1999/xhtml\">
		<head>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
		</head>
		<body>".implode("\n", $html)."</body>
		</html>";
		
		fn_print_r($content);
		exit();

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 ???