linjl296

in app purchase 订单验证失败

出现情况:在不同的机器上,有的可以验证通过,有的失败

function getReceiptData($receipt, $endpoint)
{

echo "******************华丽分割线******************";
echo $receipt;
$postData = json_encode(
array('receipt-data' => $receipt)
);

$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

$response = curl_exec($ch);
$errno = curl_errno($ch);
$errmsg = curl_error($ch);
curl_close($ch);
if ($errno != 0)
{
throw new Exception($errmsg, $errno);
}
$data = json_decode($response);

echo $data->receipt->product_id;
if(!stristr($data->receipt->product_id,'vip'))
{
$data->receipt->isVip = false;//vip不做充值
}else{
$data->receipt->isVip = true;//其他可以充值
}
return $data;

}

其中 $data->receipt->product_id;打印出的是 com.zeptolab.ctrbonus.superpower1

这个是越狱破解后,启动了内购破解程序(iap free,烧饼等等)导致的情况

设置页面关闭即可