I'm trying to get the MOC preload request working in the development site, however the request returns no data. Below is a code snippet. Any help would be appreciated.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!DOCTYPE html><html lang="en" xmlns="www.w3.org/.../xhtml"><head runat="server"> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9"> <title></title> <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0"> <meta name="CODE_LANGUAGE" content="Visual Basic 7.0"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script src="gatewayt.moneris.com/.../script>
<script type="text/javascript"> var myCheckout = new monerisCheckout(); myCheckout.setMode("qa"); myCheckout.setCheckoutDiv("monerisCheckout");
myCheckout.setCallback("page_loaded", myPageLoad); myCheckout.setCallback("cancel_transaction", myCancelTransaction); myCheckout.setCallback("error_event", myErrorEvent); myCheckout.setCallback("payment_receipt", myPaymentReceipt); myCheckout.setCallback("payment_complete", myPaymentComplete);
function PreLoad() { var xhr = new XMLHttpRequest(); var url = "gatewayt.moneris.com/.../request.php"; xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/json"); xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { var json = JSON.parse(xhr.responseText); monerisCheckout.startCheckout(json.response.ticket); }
}; var data = JSON.stringify({ "store_id": "store1", "api_token": "yesguy1", "checkout_id": "chktF8FY7tore1", "txn_total": "123.00", "environment": "qa", "action": "preload", "order_no": "TestNum" }); xhr.send(data);
}
function myPageLoad() {}
function myCancelTransaction() {}
function myErrorEvent() {}
function myPaymentReceipt() {}
function myPaymentComplete() {}
</script>
</head>
<body onload="PreLoad()"> <form id="form1" runat="server"> <div id="monerisCheckout"></div> </form></body></html>
In reply to MultipleMedia:
In reply to JasonW: