如何将PayUMoney BOLT与MVC4 c#集成



我正试图在我的项目中设置一个支付网关,我只需要点击按钮即可支付。在PayUMoney页面中,我得到了一个工具包ASP.NET BOLT,但它不在MVC中,我只知道MVC(我是一个新手(。我到处寻找如何将其与MVC4集成,但我一无所获。请帮我做这个。

<script>
$(document).ready(function ($) {
$('#payNowButton').on("click", function () {
// Have these values in my page(which is needed for BOLT)
key: "VOu0fZrK",
salt: "rWgjocyTmL",
txnid: $('#orderid').val(),
amount: $('#grandtotal').val(),
fname: $('#fname').val(),
email: $('#email').val(),
mobile: $('#phone').val(),
udf5: $('#udf5').val(),


</script>

控制器

public ActionResult Demo(Hash h)
{
//Code Which am seeking
}

不知道控制器

我解决了它,工作非常完美。我在前一页中创建了哈希,并将哈希存储到会话中并显示在支付页面上,并完成了以下操作:在支付按钮中添加onclick功能:

<script type="text/javascript"><!--
function launchBOLT() {
alert($('#txnid').val() + $('#hash').val() + $('#grandtotal').val() + $('#fname').val() + $('#email').val() + $('#phone').val() + $('#oid').val() + $('#udf5').val() + $('#surl').val());
bolt.launch({
key: "Key Here",
txnid: $('#txnid').val(),
hash: $('#hash').val(),
amount: $('#grandtotal').val(),
firstname: $('#fname').val(),
email: $('#email').val(),
phone: $('#phone').val(),
productinfo: $('#oid').val(),
udf5: $('#udf5').val(),
surl: $('#surl').val(),
furl: $('#surl').val()
}, {
responseHandler: function (BOLT) {
console.log(BOLT.response.txnStatus);
if (BOLT.response.txnStatus != 'CANCEL') {
//Salt is passd here for demo purpose only. For practical use keep salt at server side only.
var fr = '<form action="' + $('#surl').val() + '" method="post">' +
'<input type="hidden" name="key" value="' + BOLT.response.key + '" />' +
'<input type="hidden" name="salt" value="' + $('#salt').val() + '" />' +
'<input type="hidden" name="txnid" value="' + BOLT.response.txnid + '" />' +
'<input type="hidden" name="amount" value="' + BOLT.response.amount + '" />' +
'<input type="hidden" name="productinfo" value="' + BOLT.response.productinfo + '" />' +
'<input type="hidden" name="firstname" value="' + BOLT.response.firstname + '" />' +
'<input type="hidden" name="email" value="' + BOLT.response.email + '" />' +
'<input type="hidden" name="udf5" value="' + BOLT.response.udf5 + '" />' +
'<input type="hidden" name="mihpayid" value="' + BOLT.response.mihpayid + '" />' +
'<input type="hidden" name="status" value="' + BOLT.response.status + '" />' +
'<input type="hidden" name="hash" value="' + BOLT.response.hash + '" />' +
'</form>';
var form = jQuery(fr);
jQuery('body').append(form);
form.submit();
}
},
catchException: function (BOLT) {
alert(BOLT.message);
}
});
}
//--
</script>

最新更新