Output DFP JavaScript
We recommend outputting the DFP JavaScript code as early as possible to get a sufficient latency between script call and end of the checkout process. For instance, when the shopper selects one of Ratepay's payment methods.
Please ensure that this script is executed one-time only per session (per customer + checkout + device).

Example (PHP)

1
<script language="JavaScript">
2
var di = {
3
t:'<?php echo $deviceIdentToken ?>',
4
v:'<?php echo $deviceIdentSId ?>', //defined by RatePAY
5
l:'Checkout'};
6
</script>
7
<script type="text/javascript" src="https://d.ratepay.com/<?php echo $deviceIdentSId ?>/di.js"></script>
8
<noscript>
9
<link rel="stylesheet" type="text/css" href="https://d.ratepay.com/di.css?t=<?php echo $deviceIdentToken ?>&v=<?php echo $deviceIdentSId ?>&l=Checkout">
10
</noscript>
Copied!

Example (JavaScript)

1
<script language="JavaScript">
2
var di = document.createElement("script");
3
di.setAttribute('language', 'JavaScript');
4
di.innerHTML = "var di = {t:'" + token + "', v:'" + snippetid + "', l:'Checkout'};"
5
document.getElementsByTagName("body")[0].appendChild(di);
6
7
var script = document.createElement("script");
8
script.type = "text/javascript";
9
script.src = "https://d.ratepay.com/" + snippetid + "/di.js";
10
document.getElementsByTagName("body")[0].appendChild(script);
11
12
var css = document.createElement('noscript');
13
css.type = "text/css";
14
css.setAttribute("type", "text/css");
15
css.setAttribute("rel", "stylesheet");
16
css.setAttribute("href", "https://d.ratepay.com/di.css?t=" + token + "&v=" + snippetid + "&l=Checkout")
17
document.getElementsByTagName("body")[0].appendChild(css);
18
</script>
Copied!