Citrus 付款重定向 Url 不工作
Citrus Payment Redirect Url not working
我正在将柑橘支付集成到 android 应用程序中,在我的交易成功之前,在沙箱中一切都运行良好,但是一旦我的交易成功,我就会看到下面的日志:
MOTO 成功***{"txMsg":"Transaction successful","pgRespCode":"0","redirectUrl":"https://sandbox.citruspay.com/mpiServlet/715259413249776a736d6a62546c5a413247745871773d3d"}
表示交易成功,我可以在我的沙盒消费者帐户中看到交易成功,但是当它重定向到日志中 url 上方时,它显示在屏幕下方:
当我尝试按下后退按钮时:
没有办法在应用程序中达到我的最后一个 activity 我试图将 return url 放在应用程序中: private static final String RETURN_URL = " http://my.app";
我的 activity 应该 return 但没有帮助,任何帮助或提示将不胜感激。
我通过发送托管在我的服务器上的 return 页面 url 解决了问题,如下所示:
<?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); ?>
和return url显示消息交易成功并返回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>";
}
?>
我正在将柑橘支付集成到 android 应用程序中,在我的交易成功之前,在沙箱中一切都运行良好,但是一旦我的交易成功,我就会看到下面的日志:
MOTO 成功***{"txMsg":"Transaction successful","pgRespCode":"0","redirectUrl":"https://sandbox.citruspay.com/mpiServlet/715259413249776a736d6a62546c5a413247745871773d3d"}
表示交易成功,我可以在我的沙盒消费者帐户中看到交易成功,但是当它重定向到日志中 url 上方时,它显示在屏幕下方:
当我尝试按下后退按钮时:
没有办法在应用程序中达到我的最后一个 activity 我试图将 return url 放在应用程序中: private static final String RETURN_URL = " http://my.app";
我的 activity 应该 return 但没有帮助,任何帮助或提示将不胜感激。
我通过发送托管在我的服务器上的 return 页面 url 解决了问题,如下所示:
<?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); ?>
和return url显示消息交易成功并返回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>";
}
?>