Managing timeouts
A payment session is the time given to the buyer for making a payment.
The payment session delay is 10 minutes.
Once the session has expired, the buyer is disconnected. The merchant web site is notified if the “Instant Payment Notification URL on cancellation” notification rule is configured and enabled.
If the buyer makes a transaction on the payment page after the expiry of the payment session, an error message will be displayed.
To avoid this logout message, you can add a counter to your page.
After some time (5 minutes for example) the iframe will be closed automatically.
... setTimeout(window.parent.removeIframe(), '30000'); </body> </html>
Another solution consists in capturing the “message” event sent by the payment gateway in case of disconnection.
For this, paste the code below into the page that invokes the iframe:
if (window.addEventListener) {
window.addEventListener("message", onMessage, false);
} else if (window.attachEvent) {
window.attachEvent("onmessage", onMessage, false);
}
function onMessage(event) {
if (event.origin !== "https://secure.lyra.com") return;
var data = event.data;
if (typeof(window[data.func]) == "function") {
window[data.func].call();
}
}
Then, implement the handlePaymentDisconnection() function:
function handlePaymentDisconnection() { //Close iframe //Show message //Show button to relaunch payment //etc, etc }
Make sure you respect the spelling of the function name.