You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

100 lines
3.5 KiB

<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Checkout Demo</title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1" />
<script src="https://www.paynimo.com/paynimocheckout/client/lib/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<button id="btnSubmit">Proceed to Pay</button>
<h1 th:text="${token}"></h1>
<script type="text/javascript" src="https://www.paynimo.com/paynimocheckout/server/lib/checkout.js"></script>
<script type="text/javascript">
var token = "";
token = "[[${token}]]"
//console.log(token);
var txansactionId = "";
txansactionId = "[[${txansactionId}]]"
//console.log(txansactionId);
var amount = "";
amount = "[[${amount}]]"
//console.log(amount);
var merchantId = "";
merchantId = "[[${merchantId}]]"
//console.log(merchantId);
$(document).ready(function () {
function handleResponse(res) {
if (typeof res != "undefined" && typeof res.paymentMethod != "undefined" && typeof res.paymentMethod.paymentTransaction != "undefined" && typeof res.paymentMethod.paymentTransaction.statusCode != "undefined" && res.paymentMethod.paymentTransaction.statusCode == "0300") {
// success block
//console.log("Success ");
//console.log(res);
} else if (typeof res != "undefined" && typeof res.paymentMethod != "undefined" && typeof res.paymentMethod.paymentTransaction != "undefined" && typeof res.paymentMethod.paymentTransaction.statusCode != "undefined" && res.paymentMethod.paymentTransaction.statusCode == "0398") {
// initiated block
//console.log("Initiated ");
//console.log(res);
} else {
//console.log("error ");
//console.log(res);
// error block
}
};
$(document).off("click", "#btnSubmit").on("click", "#btnSubmit", function (e) {
e.preventDefault();
var reqJson = {
"features": {
"enableAbortResponse": true,
"enableExpressPay": true,
"enableInstrumentDeRegistration": true,
"enableMerTxnDetails": true,
"enableNewWindowFlow": true //for hybrid applications please disable this by passing false
},
"consumerData": {
"deviceId": "WEBSH2", //possible values "WEBSH1" or "WEBSH2"
"token": token,
"returnUrl": "/payment/response", //merchant response page URL
"responseHandler": handleResponse,
"paymentMode": "all",
"merchantLogoUrl": "https://upload.wikimedia.org/wikipedia/commons/a/a8/Chennai_Corporation_Emblem.png", //provided merchant logo will be displayed
"merchantName": "Greater Chennai Corporation",
"merchantMsg": "Community Hall Booking",
"merchantId": merchantId,
"currency": "INR",
"consumerId": "c964634",
"consumerMobileNo": "7845014181",
"consumerEmailId": "mohammedthaqi@bontonsoftwares.com",
"txnId": txansactionId, //Unique merchant transaction ID
"items": [{
"itemId": "FIRST",
"amount": amount,
"comAmt": "0"
}],
"customStyle": {
"PRIMARY_COLOR_CODE": "#45beaa", //merchant primary color code
"SECONDARY_COLOR_CODE": "#FFFFFF", //provide merchant's suitable color code
"BUTTON_COLOR_CODE_1": "#2d8c8c", //merchant's button background color code
"BUTTON_COLOR_CODE_2": "#FFFFFF" //provide merchant's suitable color code for button text
}
}
};
$.pnCheckout(reqJson);
if (reqJson.features.enableNewWindowFlow) {
pnCheckoutShared.openNewWindow();
}
});
});
</script>
</body>
</html>