首页 > 解决方案 > 如何将 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
        }

对控制器没有概念

标签: c#jqueryasp.net-mvc-4asp.net-ajaxpayumoney

解决方案


我解决了它并完美地工作。我在前一页中创建了哈希并将哈希存储到会话中并显示在支付页面上,并执行了以下操作:在支付按钮中添加了 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>

推荐阅读