简体   繁体   English

如何将Paytm与Codeigniter集成

[英]How to integrate Paytm with Codeigniter

我想在我的网站中整合paytm支付网关在我的网站上的codeigniter,我搜索了很多,但我发现只有在PHP.I尝试使用PHP库,但验证校验和它不工作。任何人都建议任何库集成paytm。

I was searching for this same option today and finally had to tweak the library they provided here . 我今天正在寻找同样的选项,最后不得不调整他们在这里提供的库。

  1. Cloned their kit to a different folder 将他们的工具包克隆到另一个文件夹
  2. Moved the contents of the folder lib to application/third_party/paytmlib 将文件夹lib的内容移动到application / third_party / paytmlib
  3. In the moved path, Configured config_paytmp.php values according to my site set 在移动的路径中,根据我的站点设置配置config_paytmp.php
  4. From their kit path moved this file TxnTest.php to views folder and changed form post tag like below <form method="post" action="paytmpost"> 从他们的工具包路径将此文件TxnTest.php移动到视图文件夹并更改了表单标签,如下所示<form method="post" action="paytmpost">
  5. Have added controller methods like below 添加了如下控制器方法

     function paytm() { $this->load->view('TxnTest'); } function paytmpost() { header("Pragma: no-cache"); header("Cache-Control: no-cache"); header("Expires: 0"); // following files need to be included require_once(APPPATH . "/third_party/paytmlib/config_paytm.php"); require_once(APPPATH . "/third_party/paytmlib/encdec_paytm.php"); $checkSum = ""; $paramList = array(); $ORDER_ID = $_POST["ORDER_ID"]; $CUST_ID = $_POST["CUST_ID"]; $INDUSTRY_TYPE_ID = $_POST["INDUSTRY_TYPE_ID"]; $CHANNEL_ID = $_POST["CHANNEL_ID"]; $TXN_AMOUNT = $_POST["TXN_AMOUNT"]; // Create an array having all required parameters for creating checksum. $paramList["MID"] = PAYTM_MERCHANT_MID; $paramList["ORDER_ID"] = $ORDER_ID; $paramList["CUST_ID"] = $CUST_ID; $paramList["INDUSTRY_TYPE_ID"] = $INDUSTRY_TYPE_ID; $paramList["CHANNEL_ID"] = $CHANNEL_ID; $paramList["TXN_AMOUNT"] = $TXN_AMOUNT; $paramList["WEBSITE"] = PAYTM_MERCHANT_WEBSITE; /* $paramList["MSISDN"] = $MSISDN; //Mobile number of customer $paramList["EMAIL"] = $EMAIL; //Email ID of customer $paramList["VERIFIED_BY"] = "EMAIL"; // $paramList["IS_USER_VERIFIED"] = "YES"; // */ //Here checksum string will return by getChecksumFromArray() function. $checkSum = getChecksumFromArray($paramList,PAYTM_MERCHANT_KEY); echo "<html> <head> <title>Merchant Check Out Page</title> </head> <body> <center><h1>Please do not refresh this page...</h1></center> <form method='post' action='".PAYTM_TXN_URL."' name='f1'> <table border='1'> <tbody>"; foreach($paramList as $name => $value) { echo '<input type="hidden" name="' . $name .'" value="' . $value . '">'; } echo "<input type='hidden' name='CHECKSUMHASH' value='". $checkSum . "'> </tbody> </table> <script type='text/javascript'> document.f1.submit(); </script> </form> </body> </html>"; } 

Note : paytmpost() is modified from the pgRedirect.php in their kit. 注意: paytmpost()是从其工具包中的pgRedirect.php修改的。 The pgResponse.php could also be tweaked to a controller function to process the output from the payment gateway. pgResponse.php也可以调整到控制器功能,以处理来自支付网关的输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM