title: 'sorry some error occurred' while integrating PayUMoney payment gateway in Test mode
body: <p>I'm trying to integrate <strong>PayUMoney</strong> payment gateway in my client site. My client provided me the login details of <strong>PayUMoney</strong>. I was able to locate the <strong>Merchant Key</strong> but cannot find either of the two:</p>
  
  <ol>
  <li>Merchant Salt</li>
  <li>Developer site where I can create a test account and test on sandbox</li>
  </ol>
  
  <p><strong>PayUMoney</strong> provided me a form with some default value but when I test, it gives the message: sorry some error occurred.</p>
  
  <p>Here is the form:</p>
  
  <pre><code>&lt;?php
  // Merchant key here as provided by Payu
  $MERCHANT_KEY = "JBZaLc";
  
  // Merchant Salt as provided by Payu
  $SALT = "GQs7yium";
  
  // End point - change to https://secure.payu.in for LIVE mode
  $PAYU_BASE_URL = "https://test.payu.in";
  
  $action = '';
  
  $posted = array();
  if(!empty($_POST)) {
  //print_r($_POST);
  foreach($_POST as $key =&gt; $value) {    
  $posted[$key] = $value; 
  
  }
  }
  
  $formError = 0;
  
  if(empty($posted['txnid'])) {
  // Generate random transaction id
  $txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
  } else {
  $txnid = $posted['txnid'];
  }
  $hash = '';
  // Hash Sequence
  $hashSequence =     "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";
  if(empty($posted['hash']) &amp;&amp; sizeof($posted) &gt; 0) {
  if(
        empty($posted['key'])
        || empty($posted['txnid'])
        || empty($posted['amount'])
        || empty($posted['firstname'])
        || empty($posted['email'])
        || empty($posted['phone'])
        || empty($posted['productinfo'])
        || empty($posted['surl'])
        || empty($posted['furl'])
        || empty($posted['service_provider'])
  ) {
  $formError = 1;
  } else {
  //$posted['productinfo'] = json_encode(json_decode('[{"name":"tutionfee","description":"","value":"500","isRequired":"false"},{"name":"developmentfee","description":"monthly tution     fee","value":"1500","isRequired":"false"}]'));
  $hashVarsSeq = explode('|', $hashSequence);
  $hash_string = '';  
  foreach($hashVarsSeq as $hash_var) {
    $hash_string .= isset($posted[$hash_var]) ? $posted[$hash_var] : '';
    $hash_string .= '|';
  }
  
  $hash_string .= $SALT;
  
  
  $hash = strtolower(hash('sha512', $hash_string));
  $action = $PAYU_BASE_URL . '/_payment';
  }
  } elseif(!empty($posted['hash'])) {
  $hash = $posted['hash'];
  $action = $PAYU_BASE_URL . '/_payment';
  }
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  var hash = '&lt;?php echo $hash ?&gt;';
  function submitPayuForm() {
    if(hash == '') {
      return;
    }
    var payuForm = document.forms.payuForm;
    payuForm.submit();
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onLoad="submitPayuForm()"&gt;
  &lt;h2&gt;PayU Form&lt;/h2&gt;
  &lt;br/&gt;
  &lt;?php if($formError) { ?&gt;
    &lt;span style="color:red"&gt;Please fill all mandatory fields.&lt;/span&gt;
    &lt;br/&gt;
    &lt;br/&gt;
  &lt;?php } ?&gt;
  &lt;form action="&lt;?php echo $action; ?&gt;" method="post" name="payuForm"&gt;
    &lt;input type="hidden" name="key" value="&lt;?php echo $MERCHANT_KEY ?&gt;" /&gt;
    &lt;input type="hidden" name="hash" value="&lt;?php echo $hash ?&gt;"/&gt;
    &lt;input type="hidden" name="txnid" value="&lt;?php echo $txnid ?&gt;" /&gt;
    &lt;table&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;b&gt;Mandatory Parameters&lt;/b&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Amount: &lt;/td&gt;
        &lt;td&gt;&lt;input name="amount" value="&lt;?php echo (empty($posted['amount'])) ? '' : $posted['amount'] ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;First Name: &lt;/td&gt;
        &lt;td&gt;&lt;input name="firstname" id="firstname" value="&lt;?php echo (empty($posted['firstname'])) ? '' : $posted['firstname']; ?&gt;" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Email: &lt;/td&gt;
        &lt;td&gt;&lt;input name="email" id="email" value="&lt;?php echo (empty($posted['email'])) ? '' : $posted['email']; ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;Phone: &lt;/td&gt;
        &lt;td&gt;&lt;input name="phone" value="&lt;?php echo (empty($posted['phone'])) ? '' : $posted['phone']; ?&gt;" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Product Info: &lt;/td&gt;
        &lt;td colspan="3"&gt;&lt;textarea name="productinfo"&gt;&lt;?php echo (empty($posted['productinfo'])) ? '' : $posted['productinfo'] ?&gt;&lt;/textarea&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Success URI: &lt;/td&gt;
        &lt;td colspan="3"&gt;&lt;input name="surl" value="&lt;?php echo (empty($posted['surl'])) ? '' : $posted['surl'] ?&gt;" size="64" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Failure URI: &lt;/td&gt;
        &lt;td colspan="3"&gt;&lt;input name="furl" value="&lt;?php echo (empty($posted['furl'])) ?     '' : $posted['furl'] ?&gt;" size="64" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
        &lt;td&gt;Service Provider: &lt;/td&gt;
        &lt;td colspan="3"&gt;&lt;input name="service_provider" value="&lt;?php echo (empty($posted['service_provider'])) ? '' : $posted['service_provider'] ?&gt;" size="64" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
        &lt;td&gt;&lt;b&gt;Optional Parameters&lt;/b&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Last Name: &lt;/td&gt;
        &lt;td&gt;&lt;input name="lastname" id="lastname" value="&lt;?php echo (empty($posted['lastname'])) ? '' : $posted['lastname']; ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;Cancel URI: &lt;/td&gt;
        &lt;td&gt;&lt;input name="curl" value="" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Address1: &lt;/td&gt;
        &lt;td&gt;&lt;input name="address1" value="&lt;?php echo (empty($posted['address1'])) ? '' : $posted['address1']; ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;Address2: &lt;/td&gt;
        &lt;td&gt;&lt;input name="address2" value="&lt;?php echo (empty($posted['address2'])) ? '' : $posted['address2']; ?&gt;" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;City: &lt;/td&gt;
        &lt;td&gt;&lt;input name="city" value="&lt;?php echo (empty($posted['city'])) ? '' : $posted['city']; ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;State: &lt;/td&gt;
        &lt;td&gt;&lt;input name="state" value="&lt;?php echo (empty($posted['state'])) ? '' : $posted['state']; ?&gt;" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Country: &lt;/td&gt;
        &lt;td&gt;&lt;input name="country" value="&lt;?php echo (empty($posted['country'])) ? '' : $posted['country']; ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;Zipcode: &lt;/td&gt;
        &lt;td&gt;&lt;input name="zipcode" value="&lt;?php echo (empty($posted['zipcode'])) ? '' : $posted['zipcode']; ?&gt;" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;UDF1: &lt;/td&gt;
        &lt;td&gt;&lt;input name="udf1" value="&lt;?php echo (empty($posted['udf1'])) ? '' : $posted['udf1']; ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;UDF2: &lt;/td&gt;
        &lt;td&gt;&lt;input name="udf2" value="&lt;?php echo (empty($posted['udf2'])) ? '' : $posted['udf2']; ?&gt;" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;UDF3: &lt;/td&gt;
        &lt;td&gt;&lt;input name="udf3" value="&lt;?php echo (empty($posted['udf3'])) ? '' : $posted['udf3']; ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;UDF4: &lt;/td&gt;
        &lt;td&gt;&lt;input name="udf4" value="&lt;?php echo (empty($posted['udf4'])) ? '' : $posted['udf4']; ?&gt;" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;UDF5: &lt;/td&gt;
        &lt;td&gt;&lt;input name="udf5" value="&lt;?php echo (empty($posted['udf5'])) ? '' : $posted['udf5']; ?&gt;" /&gt;&lt;/td&gt;
        &lt;td&gt;PG: &lt;/td&gt;
        &lt;td&gt;&lt;input name="pg" value="&lt;?php echo (empty($posted['pg'])) ? '' : $posted['pg']; ?&gt;" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;?php if(!$hash) { ?&gt;
          &lt;td colspan="4"&gt;&lt;input type="submit" value="Submit" /&gt;&lt;/td&gt;
        &lt;?php } ?&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>