【发布时间】:2019-06-30 06:59:36
【问题描述】:
我在我的项目中集成了 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 中传递任何值而不会出现校验和错误
【问题讨论】:
标签: php codeigniter payumoney