2017-04-10 140 views
0

這是我的職務要求:PHP PayuMoney集成

address1  
address2  
amount => 5000 
city  
country  
email => [email protected] 
firstname = ankit 
furl = http://<SITE_NAME>/respHandler.php 
hash = 21673423ca4e2ef5648420c440cf9222f1080dc3c54d19e51286b49459ce0cd29f4f36df6434666f4a2a7951569c57385c7c 
e78a93da780ca3210cafb1b3bc61 
key =<KEY> 
lastname  
pg 
phone=9999999999 
productinfo=Event Ticket Booking 
service_provider=payu_paisa 
state 
surl=http://<SITE_NAME>/respHandler.php 
txnid=adc7a7bdfd50478c4fdf 
udf1=1 
udf2=12 
udf3=2 
udf4  
udf5  
zipcode 

當發送該URL:https://secure.payu.in/_payment

我得到這個錯誤:

"NetworkError: 500 hphp_invoke - https://secure.payu.in/_payment "

的問題是,它工作時,金額爲10,但金額爲5000時發生錯誤。

+0

我想這個數據不是'原樣',開箱即用。你能不能展示一些準備好的代碼,以及你發送它的方式? – OldPadawan

+0

我想你應該問服務的提供者,也許錯誤是在他們身邊。 – DanFromGermany

+0

一個詳細的博客與解釋:http://sforsuresh.in/payumoney-php-payment-gateway-integration/ –

回答

0
$paymentData['key']=MERCHANT_KEY; 
$paymentData['txnid']=$txnid; 
$paymentData['amount']=$totalAmount; 
$paymentData['firstname']=$this->objSess->userName; 
$paymentData['email']=$userEmail; 
$paymentData['phone']=$this->objSess->userMobile; 
$paymentData['productinfo']=json_encode($productInfo); 
$paymentData['surl']=SUCCESS_URL; 
$paymentData['furl']=FAIL_URL; 
$paymentData['service_provider']='payu_paisa'; 
$paymentData['lastname']=''; 
$paymentData['curl']=''; 
$paymentData['address1']=''; 
$paymentData['address2']=''; 
$paymentData['city']=''; 
$paymentData['state']=''; 
$paymentData['country']=''; 
$paymentData['zipcode']=''; 
$paymentData['udf1']=''; 
$paymentData['udf2']=''; 
$paymentData['udf3']=''; 
$paymentData['udf4']=''; 

$paymentData['udf5']=''; 

$paymentData['pg']=''; 

$hashSequence = 'key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10'; 

$hashVarsSeq = explode('|', $hashSequence); 
$hash_string = ''; 
foreach($hashVarsSeq as $hash_var) { 
    $hash_string .= isset($paymentData[$hash_var]) ? $paymentData[$hash_var] : ''; 
    $hash_string .= '|'; 
} 

$hash_string .= SALT; 

$hash = strtolower(hash('sha512', $hash_string)); 

$code = ' 
     <script> 
      var hash = "'.$hash.'"; 
      function submitPayuForm() { 
       if(hash == "") { 
       return; 
       } 
       var payuForm = document.forms.payuForm; 
       payuForm.submit(); 
      } 
     </script> 
      <form action="'.PAYU_BASE_URL.'" method="post" name="payuForm" > 
       <input type="hidden" name="key" value="'.MERCHANT_KEY.'" /> 
       <input type="hidden" name="hash" value="'.$hash.'"/> 
       <input type="hidden" name="txnid" value="'.$txnid.'" /> 
       <input type="hidden" name="amount" value="'.$paymentData['amount'].'" /> 
       <input type="hidden" name="firstname" value="'.$paymentData['firstname'].'" /> 
       <input type="hidden" name="email" value="'.$paymentData['email'].'" /> 
       <input type="hidden" name="phone" value="'.$paymentData['phone'].'" /> 
       <input type="hidden" name="productinfo" value="'. htmlspecialchars($paymentData['productinfo'], ENT_QUOTES, 'UTF-8').'" /> 
       <input type="hidden" name="surl" value="'.$paymentData['surl'].'" /> 
       <input type="hidden" name="furl" value="'.$paymentData['furl'].'" /> 
       <input type="hidden" name="service_provider" value="'.$paymentData['service_provider'].'" /> 

      </form> 
      '; 
      echo $code; 
      echo "<script>submitPayuForm();</script>"; 

試試這個代碼

0

我可能會遇到同樣的問題。低於5000它正在工作。但是如果金額大於或等於5

+1

歡迎來到SO!請閱讀[如何提問](http://stackoverflow.com/help/on-topic)如果您有相關問題,可以在這裏搜索。 –

0
//this is how payumoney payment gateway is implemented in cakephp3 

$MERCHANT_KEY = "merhcant key"; //merchant key provided by payumoney 

$SALT = "salt"; //salt provided by payumoney 

$PAYU_BASE_URL = "test.payu.in"; 

$txnid = ''; 

if (empty($txnid)) { 
    $txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20); // Generate random transaction id 
} 

$hash = ''; 

$firstname = $sessionUserInfo['first_name']; 

$email = $sessionUserInfo['email']; 

$contact_no = $sessionUserInfo['contact_no']; 



$hashSequence = ($MERCHANT_KEY . "|" . $txnid . "|" . $totalAmount . "|" . $productInfo . "|" . $firstname . "|" . $email . "|||||||||||" . $SALT); 
$hash = strtolower(hash("sha512", $hashSequence));//hash Sequence generation formula 

$this->set(compact('PAYU_BASE_URL', 'MERCHANT_KEY', 'SALT', 'PAYU_BASE_URL', 'txnid', 'hash', 'productInfo', 'totalAmount'));//write above code in your controller 

<form action="<?php echo $PAYU_BASE_URL; ?>/_payment" method="post" name="payuForm"> 

<?php echo $this->Form->hidden('key', ['name' => 'key', 'value' => $MERCHANT_KEY]); ?> 
              <?php echo $this->Form->hidden('hash', ['name' => 'hash', 'value' => $hash]); ?> 
              <?php echo $this->Form->hidden('txnid', ['name' => 'txnid', 'value' => $txnid]); ?> 
              <?php echo $this->Form->hidden('amount', ['name' => 'amount', 'value' => $totalAmount]); ?> 
              <?php echo $this->Form->hidden('firstname', ['name' => 'firstname', 'value' => $authUser['first_name']]); ?> 
              <?php echo $this->Form->hidden('address', ['name' => 'address', 'value' => $authUser['address']]); ?> 
              <?php echo $this->Form->hidden('email', ['name' => 'email', 'value' => $authUser['email']]); ?> 
              <?php echo $this->Form->hidden('phone', ['name' => 'phone', 'value' => $authUser['contact_no']]); ?> 
              <?php echo $this->Form->hidden('productinfo', ['name' => 'productinfo', 'value' => $productInfo]); ?> 
              <?php echo $this->Form->hidden('surl', ['name' => 'surl', 'value' => SITE_PATH . "Payments/successPayment/"]); ?> 
              <?php echo $this->Form->hidden('furl', ['name' => 'furl', 'value' => SITE_PATH . "Payments/failUrl/"]); ?> 
              <?php echo $this->Form->button('Order', array('type' => 'submit', 'class' => 'btn btn-default btn-md round fa fa-arrow-circle-right ml-5', 'name' => 'submit')); ?> 

    </form>//write above code in your ctp file 
+1

請解釋你的答案,,,謝謝 – GYaN