如何将Payumoney付款网关与Codeigniter集成 [英] how to integrate payumoney payment gateway with codeigniter
问题描述
我已经开发了一个项目,用于通过HTML,javaScript,Php Web服务(codeigniter框架)为网站和移动应用与医生预约约会。现在我需要与Payumoney付款网关集成。所以请有人帮助我
I have developed project for booking appointments with doctors in html,javaScript,Php web services(codeigniter framework) for both website and mobile app.Now iam in need of integration with Payumoney payment gateway.so please someone help me of step by step instructions in a code.iam new to this payment integration.
推荐答案
请不要接受它,但是没有足够的文件关于互联网中的Codeigniter和stackoverflow中的payumoney集成...我已经解决了...请逐步执行该过程
Don't take it otherwise but there was no sufficient document about the payumoney integration in codeigniter in the internet as well as in stackoverflow... I have solve it... please do the process step by step
-
如果您有一个用户控制器(例如user.php),请添加一个函数payum()或类似的函数。我正在添加以下代码
if you have a 'user' controller(say user.php) add a function payum() or like that. I am adding the code bellow
function payum()
{
$userid = $this->ion_auth->get_user_id();
if(is_numeric($userid)) {
$this->data['title'] = 'payU Money cash Deposit';
$this->data['records']= $this->base_model->run_query("select * FROM users where id=".$userid
);
$this->data['content'] = 'user/payum';
$this->_render_page('user/payum', $this->data);
}
else {
$this->prepare_flashmessage('Session Expired!', 2);
redirect('auth/login', 'refresh');
}
}
然后在其中添加页面payum.php您的视图/用户(可以对其进行修改...)..我正在添加详细代码
Then add a page payum.php in your view/user (you can modify it...).. I am adding the detail code
<?php
if(count($records)) {
foreach($records as $d) {
?>
<div class="row margin" style="padding:10%">
<fieldset>
<legend>Subscription info</legend>
<div class="form-group">
<label>Name:</label> <?php echo $d->username;?> <br/>
<label>Amount:</label> <?php echo $d->fees;?><br/>
<label>E-mail:</label> <?php echo $d->email;?> <br/>
<label>Phone:</label> <?php echo $d->phone;?> <br/>
</div>
</fieldset>
<?PHP
}} ?>
</div>
<?php
$price=$d->fees;
// Merchant key here as provided by Payu
$MERCHANT_KEY = 'pay you money merchant key';
// Merchant Salt as provided by Payu
$SALT = "pay you money salt";
$txnid = $d->id ;
$hash_string = $MERCHANT_KEY."|".$txnid."|".$price."|Subscription fess MCQUES|".$d->username."|".$d->email."|".$d->id."||||||||||".$SALT;
$hash = hash('sha512', $hash_string);
?>
<div class="col-sm-12" style="padding:8%; font-family: georgia; font-size: 18px;">
<form method="POST" action="https://secure.payu.in/_payment">
<input type="hidden" name="key" value="<?php echo $MERCHANT_KEY; ?>" />
<input type="hidden" name="hash" value="<?php echo $hash; ?>"/>
<input type="hidden" name="txnid" value="<?php echo $txnid; ?>" />
You can change your contact number <input type="text" name="phone" value="<?php echo $d->phone;?>" />
<br><br><input type="hidden" name="amount" value="<?php echo $price;?>" />
<input type="hidden" name="firstname" id="firstname" value="<?php echo $d->username;?>" >
<input type="hidden" name="email" id="email" value="<?php echo $d->email;?>" />
<input type="hidden" name="productinfo" value="Subscription fess MCQUES">
<input type="hidden" name="surl" value="<?php echo base_url();?>payu/success.php" size="64" />
<input type="hidden" name="furl" value="<?php echo base_url();?>payu/failure.php" size="64" />
<input type="hidden" name="service_provider" value="payu_paisa" size="64" />
<input type="hidden" name="udf1" value="<?php echo $d->id;?>">
<input type="submit" value="Continue" class="btn btn-success" >
</form>
</div>
只需根据需要更改字段。 ...谢谢...
Just change the fields according to your needs.... Thank you...
这篇关于如何将Payumoney付款网关与Codeigniter集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!