Issue
This is the API provided by https://www.cashmaal.com/api I deposited some cash in my cashmaal account and the transaction id I got whenever I try to verify the payment by transaction id it shows me an error
Error: Error! Transaction Id () is invalid.
$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'];
}
}
Solution
Just found a solution of this that this cashmaal api verify the transaction id only if the transaction is done by other cashmaal account
Answered By - Hassan Tanveer