title: Paytm payment gateway showing error in php
body: <p>I am trying to integrate paytm(merchant/developer account) with Php.I created account in developer paytm and put keys api and secret keys in config file But i am getting error </p>
  
  <p>"Something went wrong It may be due to any of these reasons:
      Session expired due to inactivity
      Our system encountered an obstacle". </p>
  
  <p>And page redirect to following url </p>
  
  <pre><code>"https://securegw-stage.paytm.in/theia/{url}"
  </code></pre>
  
  <p>Here is my TxnTest.php file</p>
  
  <pre><code>&lt;?php
      header("Pragma: no-cache");
      header("Cache-Control: no-cache");
      header("Expires: 0");
  
  ?&gt;
      &lt;form method="post" action="pgRedirect.php"&gt;
          &lt;table border="1"&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;th&gt;S.No&lt;/th&gt;
                      &lt;th&gt;Label&lt;/th&gt;
                      &lt;th&gt;Value&lt;/th&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;1&lt;/td&gt;
                      &lt;td&gt;&lt;label&gt;ORDER_ID::*&lt;/label&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input id="ORDER_ID" tabindex="1" maxlength="20" size="20"
                          name="ORDER_ID" autocomplete="off"
                          value="&lt;?php echo  "ORDS" . rand(10000,99999999)?&gt;"&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;2&lt;/td&gt;
                      &lt;td&gt;&lt;label&gt;CUSTID ::*&lt;/label&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input id="CUST_ID" tabindex="2" maxlength="12" size="12" name="CUST_ID" autocomplete="off" value="CUST001"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;3&lt;/td&gt;
                      &lt;td&gt;&lt;label&gt;INDUSTRY_TYPE_ID ::*&lt;/label&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input id="INDUSTRY_TYPE_ID" tabindex="4" maxlength="12" size="12" name="INDUSTRY_TYPE_ID" autocomplete="off" value="Retail"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;4&lt;/td&gt;
                      &lt;td&gt;&lt;label&gt;Channel ::*&lt;/label&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input id="CHANNEL_ID" tabindex="4" maxlength="12"
                          size="12" name="CHANNEL_ID" autocomplete="off" value="WEB"&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;5&lt;/td&gt;
                      &lt;td&gt;&lt;label&gt;txnAmount*&lt;/label&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input title="TXN_AMOUNT" tabindex="10"
                          type="text" name="TXN_AMOUNT"
                          value="1"&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input value="CheckOut" type="submit"   onclick=""&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
          * - Mandatory Fields
      &lt;/form&gt;
  </code></pre>
  
  <p>Here is my pgRedirect.php file code</p>
  
  <pre><code>&lt;?php
  header("Pragma: no-cache");
  header("Cache-Control: no-cache");
  header("Expires: 0");
  // following files need to be included
  require_once("./lib/config_paytm.php");
  require_once("./lib/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["CALLBACK_URL"] = "http://localhost/PaytmKit/pgResponse.php";
  $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);
  
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Merchant Check Out Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;?php echo PAYTM_TXN_URL; 
  
  ?&gt;
  
  &lt;body&gt;
      &lt;center&gt;&lt;h1&gt;Please do not refresh this page...&lt;/h1&gt;&lt;/center&gt;
          &lt;form method="post" action="&lt;?php echo PAYTM_TXN_URL ?&gt;" name="f1"&gt;
          &lt;table border="1"&gt;
              &lt;tbody&gt;
              &lt;?php
              foreach($paramList as $name =&gt; $value) {
                  echo '&lt;input type="hidden" name="' . $name .'" value="' . $value . '"&gt;';
              }
              ?&gt;
              &lt;input type="hidden" name="CHECKSUMHASH" value="&lt;?php echo $checkSum ?&gt;"&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
          &lt;script type="text/javascript"&gt;
              document.f1.submit();
          &lt;/script&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>here is my config_paytm.php</p>
  
  <pre><code>&lt;?php
  
  define('PAYTM_ENVIRONMENT', 'TEST'); // PROD
  define('PAYTM_MERCHANT_KEY', 'xxxxxxxxxxxxxxxxx'); //Change this constant's value with Merchant key received from Paytm.
  define('PAYTM_MERCHANT_MID', 'xxxxxxxxxxxxxxxx'); //Change this constant's value with MID (Merchant ID) received from Paytm.
  define('PAYTM_MERCHANT_WEBSITE', 'http://myurl/testd/paytm/index.php'); //Change this constant's value with Website name received from Paytm.
  
  $PAYTM_STATUS_QUERY_NEW_URL='https://securegw-stage.paytm.in/merchant-status/getTxnStatus';
  $PAYTM_TXN_URL='https://securegw-stage.paytm.in/theia/processTransaction';
  if (PAYTM_ENVIRONMENT == 'PROD') {
      $PAYTM_STATUS_QUERY_NEW_URL='https://securegw.paytm.in/merchant-status/getTxnStatus';
      $PAYTM_TXN_URL='https://securegw.paytm.in/theia/processTransaction';
  }
  
  define('PAYTM_REFUND_URL', '');
  define('PAYTM_STATUS_QUERY_URL', $PAYTM_STATUS_QUERY_NEW_URL);
  define('PAYTM_STATUS_QUERY_NEW_URL', $PAYTM_STATUS_QUERY_NEW_URL);
  define('PAYTM_TXN_URL', $PAYTM_TXN_URL);
  ?&gt;
  </code></pre>