Skip to main content

Events

completed

If windowstate = 4, this function is called when the payment window is closed.

Please note the highlighted line in the example below.

<div id="payment-div"></div>
<script type="text/javascript">
function PaymentWindowReady()
{
paymentwindow = new PaymentWindow({
'merchantnumber': "ENTER YOUR MERCHANT NUMBER HERE",
'amount': "10095",
'currency': "DKK",
'windowstate': "4",
'iframeheight': "400",
'iframewidth': "360"
});
paymentwindow.on('completed', function(params){ alert('The Payment Window was completed: ' + params); });
paymentwindow.append('payment-div');
paymentwindow.open();
}
</script>
<script charset="UTF-8" src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js" type="text/javascript"></script>

declined

If windowstate = 4, this function is called when a payment is declined.

Please note the highlighted line in the example below.

<div id="payment-div"></div>
<script type="text/javascript">
function PaymentWindowReady()
{
paymentwindow = new PaymentWindow({
'merchantnumber': "ENTER YOUR MERCHANT NUMBER HERE",
'amount': "10095",
'currency': "DKK",
'windowstate': "4",
'iframeheight': "400",
'iframewidth': "360"
});
paymentwindow.on('declined', function(){ alert('The Payment Window was declined'); });
paymentwindow.append('payment-div');
paymentwindow.open();
}
</script>
<script charset="UTF-8" src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js" type="text/javascript"></script>

close

If windowstate = 1, this function is called when the payment window is closed.

Please note the highlighted line in the example below.

<script type="text/javascript" src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js" charset="UTF-8"></script>

<script type="text/javascript">
paymentwindow = new PaymentWindow({
'merchantnumber': "ENTER YOUR MERCHANT NUMBER HERE",
'amount': "10095",
'currency': "DKK"
});
paymentwindow.on('close', function(){ alert('The Payment Window was closed.') });
</script>

<input type="button" onclick="javascript: paymentwindow.open()" value="Go to payment" />

feecalculated

This event includes a parameter which is the fee calculated on the basis of the cardtype. Note that the fee is in minor units. Feecalculated occurs when the customer enters the card details, and ePay registers the card type.

<div id="payment-div">
<iframe
src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/LoadingPage.aspx"
width="360"
height="400"
frameborder="0"
allowtransparency="true"
name="epay_frame"
id="epay_frame"
></iframe>
</div>
<script type="text/javascript">
function PaymentWindowReady() { paymentwindow = new PaymentWindow({ 'merchantnumber': "ENTER YOUR MERCHANT NUMBER HERE", 'amount': "10095", 'currency': "DKK", 'windowstate': "4", 'iframeheight': "400", 'iframewidth': "360" }); paymentwindow.on('feecalculated', function(fee){ alert(fee); }); paymentwindow.append('payment-div'); paymentwindow.open(); }  <script charset="UTF-8" src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js" type="text/javascript"></telerik:script></pre>
</script>

precompleted

This function doesn't include any parameters but is an event that tells that the user pressed the `complete payment`` button in the payment window. You can show the user that the transaction starts and inform the user that she doesn't have to do anything.

If the payment is declined, you'll get a declined event (see above).

<div id="payment-div"></div>
<script type="text/javascript">
function PaymentWindowReady() {
paymentwindow = new PaymentWindow({
merchantnumber: "ENTER YOUR MERCHANT NUMBER HERE",
amount: "10095",
currency: "DKK",
windowstate: "4",
iframeheight: "400",
iframewidth: "360",
});

paymentwindow.on("precompleted", function () {
//Validate the customer information here

//If OK:
paymentwindow.submit();
});

paymentwindow.append("payment-div");
paymentwindow.open();
}
</script>
<script
charset="UTF-8"
src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js"
type="text/javascript"
></script>