Citrus Payment Redirect Url not working

1.2k Views Asked by At

I am integrating citrus payment into android app , everything is working well in sandbox till my transaction is successful but once my transaction is successful i get below logs :

enter image description here

MOTO SUCCESSFUL***{"txMsg":"Transaction successful","pgRespCode":"0","redirectUrl":"https://sandbox.citruspay.com/mpiServlet/715259413249776a736d6a62546c5a413247745871773d3d"}

Which says transaction is successful and i can see in my sandbox consumer account that transaction is successful but when it redirect to above url in log it shows below screen :

enter image description here

And When i try to press back button :

There is no way out to reach my last activity in application i tried to put return url in app as : private static final String RETURN_URL = "http://my.app";

which should return to my activity but didn't help, Any help or hint would be greatly appreciated.

enter image description here

1

There are 1 best solutions below

1
On BEST ANSWER

I resolved the Issue Via sending the return page url which was hosted on my server itself like below :

 <?php    
 $access_key = "xxxx"; //put your own access_key - found in admin panel     
 $secret_key = "xxxxx"; //put your own secret_key - found in admin panel     
 $return_url = "http://xxxxx/Citrus/return_page.php"; //put your own return_url.php here.    
 $txn_id = time() . rand(10000,99999);    
 $value = $_GET["amount"]; //Charge amount is in INR by default    
 $data_string = "merchantAccessKey=" . $access_key
               . "&transactionId="  . $txn_id          
              . "&amount="         . $value;    
 $signature = hash_hmac('sha1', $data_string, $secret_key);    
 $amount = array('value' => $value, 'currency' => 'INR');    
 $bill = array('merchantTxnId' => $txn_id,      
               'amount' => $amount,        
               'requestSignature' => $signature,         
               'merchantAccessKey' => $access_key,        
               'returnUrl' => $return_url);     echo json_encode($bill);   ?>   

And return url shows the message successful transaction and back to Activity ! .

<html>    
<head>    
<script type="text/javascript">     
var globaldata;      
function setdata(data) {          
globaldata = data;      
}      
function postResponseiOS() {          
return globaldata;      
}      
function postResponse(data) {          
CitrusResponse.pgResponse(data);      }    
</script>     
</head>     
<body>     
</body>     
</html>                
<?php                    
$secret_key = "xxxxx";     
$data =array();     
foreach ($_POST as $name => $value) {                   
 $data[$name] = $value;                   
}     
   $verification_data =  $data['TxId']                        
                        . $data['TxStatus']                        
                        . $data['amount']                        
                        . $data['pgTxnNo']                        
                        . $data['issuerRefNo']                        
                        . $data['authIdCode']                        
                        . $data['firstName']                        
                        . $data['lastName']                        
                        . $data['pgRespCode']                        
                        . $data['addressZip'];     
$signature = hash_hmac('sha1', $verification_data, $secret_key);     
  if ($signature == $data['signature'])  
    {                                                 
      $json_object = json_encode($data);                                                
      echo "<script> 
      postResponse('$json_object'); 
      </script>";                                               
      echo"<script> setdata ('$json_object');
      </script>";                                             
    }                                           
  else {                                               
     $response_data = array("Error" => "Transaction Failed",
     "Reason" => "Signature Verification Failed");                                              
 $json_object = json_encode($response_data);                                                
 echo "
 <script> 
 postResponse('$json_object'); 
 </script>";            
 echo"
 <script> 
 setdata ('$json_object'); 
 </script>";                                          
 }      
?>