首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ccavenue api与codeigniter的集成

ccavenue api与codeigniter的集成
EN

Stack Overflow用户
提问于 2013-08-07 19:08:49
回答 2查看 22.1K关注 0票数 4

我是codeigniter的新手,我正在开发一个像flipkart这样的电子商务应用程序,使用codeigniter,现在我想集成ccavenue支付网关到我们的网站,我已经参考了许多关于这一点的网站,但我无法得到适当的解决方案。请帮帮我,并为我提供ccavenue api文档。而且我还没有得到集成ccavenue.but的代码,我已经通过下面的url http://integrate-payment-gateway.blogspot.in/2012/01/ccavenue-payment-integration-php.html来继续集成ccavenue,我不知道如何将php脚本解析为codeigniter。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-08-08 14:39:24

在这里,您可以获得文档。

http://world.ccavenue.com/downloads/CCAVenueWorldIntegrationManual.pdf

您可以从ccavenue帐户获取代码。只要要求ccavenue帐户持有人将包含3种语言代码的zip文件夹发送给您,您必须使用php文件夹。

请提出以下要求

  1. 集成套件:

登录到ccavenue帐户并单击链接下载该工具包。您将在“如何设置您的ccavenue account?".

  • Working密钥:转到顶部菜单中的设置和选项链接并单击生成工作密钥链接”中找到此链接。并选择激活option.

  • Merchant Id:您将在创建工作密钥的同一页面中看到它。

获得代码后,您只需以codeigniter的方式使用该代码。

你也可以看看这段代码。

http://technoread.net/webdesign/payment-gateways/item/238-ccavenue-payment-integration-php

票数 7
EN

Stack Overflow用户

发布于 2016-11-10 21:29:22

代码语言:javascript
复制
             **Here is your view file subscription.php**

                 <html>
                   <head>
                              <script>
                                 window.onload = function() {
                                 var d = new Date().getTime();
                                document.getElementById("tid").value = d;
                                     };
                              </script>
                     </head>
          <body>
        <form method="POST" name="customerData" action="<?php echo base_url('ws_user/ccavRequestHandler'); ?>">
                                    <input type="hidden" name="tid" id="tid"  />
                <input type="hidden" name="merchant_id" value="your merchent id"/>
                <input type="hidden" name="payment_option" value="OPTNBK">  
                <input type="hidden" name="order_id" value="123654789"/>
                <input type="hidden" name="merchant_param1" value="your custom value"/>
                <input type="hidden" name="merchant_param2" value="<?php echo $userId; ?>"/>
                <input type="hidden" name="amount" value="<?php echo $amount; ?>"/>
                <input type="hidden" name="currency" value="INR"/>
                <input type="hidden" name="redirect_url" value="<?php  echo base_url('webservice/payDone');?>"/>
                <input type="hidden" name="cancel_url" value="<?php  echo base_url('webservice/cancelPayment');?>"/>
                <input type="hidden" name="billing_name" value="<?php echo $addressData[0]->name;?>"/>
                <input type="hidden" name="billing_address" value="<?php echo $addressData[0]->AddressLine1 . ' '.  $addressData[0]->Addressline2;?>"/>
                <input type="hidden" name="billing_city" value="<?php echo $addressData[0]->city_name;?>"/>
               <input type="hidden" name="billing_state" value="<?php echo $addressData[0]->state_name;?>"/>
             <input type="hidden" name="billing_zip" value="<?php echo $addressData[0]->Zipcode;?>"/>
             <input type="hidden" name="billing_country" value="<?php echo $addressData[0]->country_name;?>"/>
             <input type="hidden" name="billing_tel" value="<?php echo $addressData[0]->contact;?>"/>
       </form>
    <script language='javascript'>document.customerData.submit();</script>
  </body>
</html>

这是您的CI函数

代码语言:javascript
复制
         public function ccavRequestHandler()
    {
        $this->load->view('ccavRequestHandler');
    }

这是您的文件ccavRequestHandler.php

代码语言:javascript
复制
         <html>
              <body>
                <?php include('Crypto.php')?>
               <?php 
                   $merchant_data='';
                  $working_key='your working key';//Shared by CCAVENUES
                  $access_code='your access code';//Shared by CCAVENUES
                  foreach ($_POST as $key => $value)
                  {
                    $merchant_data.=$key.'='.urlencode($value).'&';
                  }
                $encrypted_data=encrypt($merchant_data,$working_key); ?>
             <form method="post" name="redirect" action="https://test.ccavenue.com/transaction/transaction.do?command=initiateTransaction"> 
            <?php
            echo "<input type=hidden name=encRequest value=$encrypted_data>";
            echo "<input type=hidden name=access_code value=$access_code>";?>
          </form>
         <script language='javascript'>document.redirect.submit()</script>
          </body>
         </html>

这是您的成功URL

代码语言:javascript
复制
   public function payDone()
    {
                     $encResp=$_REQUEST['encResp'];
                     $working_key='YOURKEY';
                     $decryptValues=explode('&',$this->common->decrypt($encResp,$working_key));
                     $dataSize=sizeof($decryptValues);
                     /*CODE FOR GET YOUR VERIABLE WHEN REDIRECT ON YOUR URL */
                        for($i = 0; $i < $dataSize; $i++) 
            {
                $information=explode('=',$decryptValues[$i]);

                if($information[0] == 'merchant_param1')
                {
                    $address = $information[1];
                }
                if($information[0] == 'merchant_param2')
                {
                   $userid = $information[1];

                }
                if($information[0] == 'order_status')
                {
                   $order_status = $information[1];

                }
            }
        /*CHECK PAYMENT IS SUCCESS OR FAIL */
           if($order_status == 'Success')
                                  {
         /* DO what ever you want after successful payment */                                                    Redirect('webservice/paymentSuccess');
                                  }
                                  else 
                                  {
                           /* do whatever you want after failure */
                                     redirect('webservice/paymentFail');
                                  }
    }
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18101825

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档