c# - 如何将 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>
推荐阅读
- php - Symfony 5 SQLSTATE [HY000] [2002] php_network_getaddresses:getaddrinfo 失败:
- javascript - 如何将多个 js 文件中的变量发送到一个 ejs 文件?
- c# - 在 Blazor 中使用 Javascript 互操作获取 URL
- python - 带有变量的Python多行graphql突变-KeyError
- java - 在 PostgraSQL 上选择 FROM OR
- c++ - 如何使用 qml 在 Qt 中创建 Material Design 导航抽屉
- android - Unity3D静态飞溅图像缩放选项不起作用
- spring - FK 在一对多关系中引用的 JPA 组合 PK
- python - 用python display b''登录豆瓣
- jquery - Ans 键出现了,但没有任何计算可以使用