我在我的项目中集成了payumoney付款网关,并且运行良好,但是我还有其他要求,因此我想传递的是id。我得到这样的ID:'$ this-> input-> post('id'),并将其分配给变量$ plan_info并将其传递给确认页面(查看页面),当用户单击确认按钮时,付款将通过借记/网上银行完成。在成功页面中,我没有获得$ plan_info值,但是我正在传递到确认页面。
用控制器编写的代码
$product_info = 'testTransaction';
$customer_name = $this->input->post('customer_name');
$customer_email = $this->input->post('customer_email');
$customer_mobile = $this->input->post('mobile_number');
$id = $this->input->post('id');
$customer_address = $this->input->post('customer_address');
$MERCHANT_KEY = "xyz";
$SALT = "xyzxyz";
$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
//optional udf values
$udf1 = '';
$udf2 = '';
$udf3 = '';
$udf4 = '';
$udf5 = '';
$hashstring = $MERCHANT_KEY . '|' . $txnid . '|' . $amount . '|' . $product_info . '|' . $customer_name . '|' . $customer_email . '|'. $udf1 . '|' . $udf2 . '|' . $udf3 . '|' . $udf4 . '|' . $udf5 . '||||||' . $SALT;
$hash = strtolower(hash('sha512', $hashstring));
$success = base_url() . 'Success';
$fail = base_url() . 'Success';
$cancel = base_url() . 'Success';
$data = array(
'mkey' => $MERCHANT_KEY,
'tid' => $txnid,
'hash' => $hash,
'amount' => $amount,
'name' => $customer_name,
'productinfo' => $product_info,
'mailid' => $customer_email,
'phoneno' => $customer_mobile,
'address' => $customer_address,
'action' => "https://test.payu.in", //for live change action
https://secure.payu.in
'sucess' => $success,
'failure' => $fail,
'cancel' => $cancel,
'plan_info'=>$id // This value which is passed to confirm page should get back in payment success response
);
$this->load->view('confirmation', $data);
在视图文件中编写的代码
<div class="card-body">
<form action="<?php echo $action; ?>/_payment" method="post" id="payuForm" name="payuForm">
<input type="hidden" name="key" value="<?php echo $mkey; ?>" />
<input type="hidden" name="hash" value="<?php echo $hash; ?>"/>
<input type="hidden" name="txnid" value="<?php echo $tid; ?>" />
<div class="form-group">
<label class="control-label">Total Payable Amount</label>
<input class="form-control" name="amount" value="<?php echo $amount; ?>" readonly/>
</div>
<div class="form-group">
<label class="control-label">Your Name</label>
<input class="form-control" name="firstname" id="firstname" value="<?php echo $name; ?>" readonly/>
</div>
<div class="form-group">
<label class="control-label">Email</label>
<input class="form-control" name="email" id="email" value="<?php echo $mailid; ?>" readonly/>
</div>
<div class="form-group">
<label class="control-label">Phone</label>
<input class="form-control" name="phone" value="<?php echo $phoneno; ?>" readonly />
</div>
<div class="form-group">
<label class="control-label"> Booking Info</label>
<input class="form-control" name="productinfo" value="<?php echo $productinfo; ?>" readonly />
<input type="hidden" class="form-control" name="plan_info" value="<?php echo $plan_info; ?>" />
</div>
<div class="form-group">
<label class="control-label">Address</label>
<input class="form-control" name="address1" value="<?php echo $address; ?>" readonly/>
</div>
<div class="form-group">
<input name="surl" value="<?php echo $sucess; ?>" size="64" type="hidden" />
<input name="furl" value="<?php echo $failure; ?>" size="64" type="hidden" />
<!--for test environment comment service provider -->
<input type="hidden" name="service_provider" value="payu_paisa" size="64" />
<input name="curl" value="<?php echo $cancel; ?> " type="hidden" />
</div>
<div class="form-group float-right">
<input type="submit" value="Pay Now" class="btn btn-success" />
</div>
</form>
</div>
我的要求
1)我如何在udf1内部传递值(如果我传递$udf1
,那么我会得到校验和错误)。
2)如果$planinfo
变量是单独传递的(不在$udf1
中传递),那么如何在成功页面中获取该值(我尝试过echo '<pre>'; print_r($_POST); exit();
),除$plan_info
以外的所有值都将获取值。
那么如何获取计划信息值以及如何在uf1中传递任何值而不会出现校验和错误
答案 0 :(得分:0)
在$ data数组中传递$ udf1值,例如
$ data = array('udf1'=> $ id,..)
还在视图页面中添加/传递udf1值。