这是https://www.cashmaal.com/api提供的API,每当我尝试通过交易ID验证付款时,我都会在我的现金帐户中存入一些现金和获得的交易ID,
错误:错误!交易ID()无效。
$web_id=""; // Your Web ID here (you can found this on cashmaal account where you add site)
if(isset($_POST['CM_TID'])) {
$CM_TID=$_POST['CM_TID']; // getting TID with user redirection
$url="https://www.cashmaal.com/Pay/verify_v2.php?CM_TID=".urlencode($CM_TID)."&web_id=".urlencode($web_id);
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result,true);
if($obj['status'] == 1)
{ // it means payment received....
//response format in JSON
//Example Response
/*
{"status":"1","receiver_account":"8","USD_amount":"1.670","fee_in_USD":"0.000","PKR_amount":"280","fee_in_PKR":"0","USD_amount_with_fee":"1.670","PKR_amount_with_fee":"280","trx_website":"website.com","transaction_id":"2JW9651118P","trx_date":"25-03-2020 9:13:48 PM","order_id":"12345678","addi_info":"Test Payment","sender_details":"Fund Received From 161919","trx_details":"$1.67 Receive against TID: '2JW9651118P'"}
*/
// Verify All things and Confirm user order here
if($obj['USD_amount'] == '2')
{
echo 'we received your payment';
}
else
{
echo "we didn't received the your mentioned payment ";
}
}
else
{
echo "Error:".$obj['error'];
}
}
答案 0 :(得分:0)
找到了一个解决方案,即只有当交易由其他Cashmaal帐户完成时,此Cashmaal api才会验证交易ID