0

我正在研究 codeigniter 并集成 payumoney 支付网关。在这里我有一个注册表单,表单中有各种字段现在我在做什么我想添加 payumoney 支付网关,但问题是当我添加写 fname 或我自己的金额时它工作正常但是当我使用 $ this->input->post('first_name') 它显示如下错误 点击查看图片(这是图片中的错误)

这是数据变量 数据数组的值

我的代码如下:

function checkout() {
        $this->load->config('payu');
        $MERCHANT_KEY = $this->config->item('MERCHANT_KEY');
        $SALT = $this->config->item('SALT');
        $PAYU_BASE_URL = $this->config->item('PAYU_BASE_URL');
        $action = '';
        $txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);

        $udf1 = '';
        $udf2 = '';
        $udf3 = '';
        $udf4 = '';
        $udf5 = '';
        $amount = $this->input->post('corporate_plan_rate');
        $productinfo = 'test';
        $fname = $this->input->post('user_name');
        $email = $this->input->post('user_email');


        $data = array(
            'mkey' => $MERCHANT_KEY,
            'tid' => $txnid,
            'MERCHANT_KEY'=>$MERCHANT_KEY,
            'txnid'=>$txnid,
            'SALT'=>$SALT,
//          'hash' => $hash,
            'amount' => $amount,
            'pinfo' => $productinfo,
            'name' => $fname,
            'productinfo'=>$productinfo,
            'mailid' => $email,
            'phoneno' => '9646403748',
            'udf1' => $udf1,
            'udf2' => $udf2,
            'udf3' => $udf3,
            'udf4' => $udf4,
            'udf5' => $udf5,
        );

        $this->load->view('payu/checkout.php', $data);
    }

这是我的视图页面:

<html>
    <head>
        <!--<script src="//code.jquery.com/jquery.min.js"></script>-->
        <script>
//          $(function () {
//              setTimeout(function () {
//                  $('form').submit();
//              }, 2000)
//          });
        </script>
    </head>
    <body>
        <?php
        $hashstring = $MERCHANT_KEY . '|' . $txnid . '|' . $amount . '|' . $productinfo . '|' . $name . '|' . $mailid . '|' . $udf1 . '|' . $udf2 . '|' . $udf3 . '|' . $udf4 . '|' . $udf5 . '||||||' . $SALT;

        $hash = strtolower(hash('sha512', $hashstring));
        ?>
        <h2>PayU Form</h2>
        <br/>
        <form method="post" name="payuForm" action="https://test.payu.in/_payment">

            <input name="key" type="hidden" value="<?php echo $mkey ?>" />
            <input name="txnid" type="hidden"  value="<?php echo $tid ?>" />
            <input type="hidden" name="hash" value="<?php echo $hash ?>"/>

            <input name="amount" type="hidden" value="<?php echo $amount; ?>" />

            <input name="productinfo" type="hidden" value="<?php echo $pinfo; ?>">

            <input type="hidden" name="service_provider" value="payu_paisa" size="64" />
            <input name="udf1" type="hidden" value="">
            <input name="udf2" type="hidden" value="">
            <input name="udf3" type="hidden" value="">
            <input name="udf4" type="hidden" value="">
            <input name="udf5" type="hidden" value="">

            <input name="firstname" id="firstname" type="hidden" value="<?php echo $name; ?>"/>

            <input name="email" id="email"  type="hidden"  value='<?php echo $mailid; ?>'>

            <input name="phone"   type="hidden"  value="<?php echo $phoneno; ?>">
            <input name="surl" type="hidden" value="<?php echo base_url('payu/success'); ?>" size="64" />
            <input name="furl" type="hidden" value="<?php echo base_url('payu/cancel'); ?>" size="64" />
            <input name="curl" type="hidden" value="<?php echo base_url('payu/cancel'); ?>" />

            <input type="submit" name="submit_form" value="Click Here for Payment" class="btn btn-info btn-block" >
        </form>
    </body>
</html>

请帮我找出问题并解决它..谢谢

4

1 回答 1

0

请用以下代码完全替换您的控制器功能

function checkout() 
{

        $MERCHANT_KEY = "enter your test merchant key here";
        $SALT = "enter your test salt here";

        $txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);

        $udf1 = '';
        $udf2 = '';
        $udf3 = '';
        $udf4 = '';
        $udf5 = '';
        $amount = $this->input->post('corporate_plan_rate');
        $productinfo = 'test_payment';
        $fname = $this->input->post('user_name');
        $email = $this->input->post('user_email');

        $hashstring = $MERCHANT_KEY . '|' . $txnid . '|' . $amount . '|' . $productinfo . '|'. $fname . '|' . $email .'|'.$udf1.'|' .$udf2.'|' .$udf3.'|'.$udf4.'|'.$udf5.'||||||'. $SALT;

        $hash = strtolower(hash('sha512', $hashstring));

        $data = array(
            'mkey' => $MERCHANT_KEY,
            'tid' => $txnid,
            'hash' => $hash,
            'amount' => $amount,
            'pinfo' => $productinfo,
            'name' => $fname,
            'productinfo'=>$productinfo,
            'mailid' => $email,
            'phoneno' => '9646403748',
        );

        $this->load->view('payu/checkout', $data);
}

现在用以下代码完全替换您的结帐视图文件

<html>
    <head>
    </head>
    <body>

        <h2>PayU Form</h2>
        <br/>
        <form method="post" name="payuForm" action="https://test.payu.in/_payment">

            <input name="key" type="hidden" value="<?php echo $mkey ?>" />
            <input name="txnid" type="hidden"  value="<?php echo $tid ?>" />
            <input type="hidden" name="hash" value="<?php echo $hash ?>"/>

            <input name="amount" type="hidden" value="<?php echo $amount; ?>" />

            <input name="productinfo" type="hidden" value="<?php echo $pinfo; ?>">

            <input type="hidden" name="service_provider" value="payu_paisa" size="64" />
            <input name="udf1" type="hidden" value="">
            <input name="udf2" type="hidden" value="">
            <input name="udf3" type="hidden" value="">
            <input name="udf4" type="hidden" value="">
            <input name="udf5" type="hidden" value="">

            <input name="firstname" id="firstname" type="hidden" value="<?php echo $name; ?>"/>

            <input name="email" id="email"  type="hidden"  value='<?php echo $mailid; ?>'>

            <input name="phone"   type="hidden"  value="<?php echo $phoneno; ?>">

            <input name="surl" type="hidden" value="<?php echo base_url('payu/success'); ?>" size="64" />
            <input name="furl" type="hidden" value="<?php echo base_url('payu/cancel'); ?>" size="64" />
            <input name="curl" type="hidden" value="<?php echo base_url('payu/cancel'); ?>" />

            <input type="submit" name="submit_form" value="Click Here for Payment" class="btn btn-info btn-block" >
        </form>
    </body>
</html>

请在不添加任何您自己的代码进行测试的情况下尝试上面的代码,如果出现相同的错误,请在下面评论。

于 2017-02-12T07:12:01.217 回答