The sample library referenced in the tutorial uses an ashx file to process the callback.
To validate the payment the sample code compares various items sent to Wallet with results returned from Wallet.
Using the sandbox my code executes as expected and verifies provided I do not do the detailed comparisons. I do not know how to pass the details to the ashx file so that the comparisons can be performed. The callback url is specified in the merchant profile, and in my case is named callback.ashx.
<script type="text/javascript">
google.load('payments', '1.0', {
'packages': ['sandbox_config']
});
function purchase(callback) {
google.payments.inapp.buy({
"parameters": {},
"jwt": "<%=theJWT() %>",
"success": function (result) {
if (isFunction(callback)) {
callback(true, result);
}
},
"failure": function (result) {
if (isFunction(callback)) {
callback(false, result);
}
}
}
)
};
function isFunction(possibleFunction) {
return (typeof (possibleFunction) === typeof (Function));
}
/*** S A M P L E O N L Y ****
*******************************
!You should verify server side!
*******************************
*/
var sampleParseResult = function (isgood, data) {
var _console = (typeof window.console === "undefined");
if (isgood) {
var _str = "Verify Order No. " + data.response.orderId;
_str += "\nDetails:\n";
_str += data.request.name + " " + data.request.description + "\n";
_str += data.request.price + "\n";
alert(_str);
if (!_console) {
console.log(data);
}
} else {
alert("failed");
if (!_console) {
console.log(data);
}
}
};
</script>
It all works as it stands but I would like to pass the object containing the request details to the ashx file. Is it possible?