2015-11-19 54 views
1

我整合柑橘支付到Android應用程序,一切都在沙箱中,直到我的交易運作良好,是成功的,但一旦我的交易是成功的,我得到下面的日誌:柑橘付款重定向URL不工作

enter image description here

MOTO成功*** { 「txMsg」: 「交易成功」, 「pgRespCode」: 「0」, 「的redirectUrl」: 「https://sandbox.citruspay.com/mpiServlet/715259413249776a736d6a62546c5a413247745871773d3d」}

它說交易成功,我可以在我的沙盒消費者帳戶中看到交易成功,但是當它redi RECT以上URL日誌它顯示如下界面:

enter image description here

,當我嘗試按後退按鈕:

沒有出路,以達到我的應用最後一項活動,我試圖把回在應用程序中的URL爲:private static final String RETURN_URL =「http://my.app」;

這應該返回到我的活動,但沒有幫助,任何幫助或提示將不勝感激。

enter image description here

回答

1

我解決了這個問題通過發送這是我自己的服務器上承載像下面的返回頁面網址:

<?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); ?> 

,並返回URL顯示消息成功交易並返回到活動! 。

<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>";           
}  
?>  
+0

@ MyMaterPiece,從哪裏CitrusResponse來自哪裏? –