如何将payumoney支付网关与codeigniter集成

时间:2016-01-28 10:07:04

标签: php codeigniter

我已经为网站和移动应用程序开发了与医生预约html,javaScript,Php网络服务(codeigniter框架)预约的项目。现在我需要与Payumoney支付网关集成。所以请有人帮我一步一步这个支付集成的新代码中的步骤说明。

1 个答案:

答案 0 :(得分:1)

不要接受它,否则没有足够的文件关于互联网上的codeigniter以及stackoverflow中的payumoney集成......我已经解决了......请逐步完成这个过程

  1. 如果你有一个'用户'控制器(比如user.php)添加一个函数payum()或类似的。我正在添加下面的代码

     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');
    }
    }  
    
  2. 然后在您的视图/用户中添加页面payum.php(您可以修改它...)..我正在添加详细代码

    <?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>
    
  3. 只需根据您的需要更改字段....谢谢......