主:开发国外接口一定要记得翻墙,本人开发就吃了这个亏,之前一直跑不通,并没有任何返回,也找不到报错原因,最终发现无法访问国外Google服务器。。。。
public function JpGooglePay(){
$google_public_key = "你的公钥(google后台在你的应用下获取)";
$inapp_purchase_data = $_REQUEST['signtureTemp'];
$inapp_data_signature = $_REQUEST['signtureDataTemp'];
$requestData = json_decode($inapp_purchase_data,TRUE);
$goodsid = $requestData['productId'];
$paytime = $requestData['purchaseTime'];
$paytime = substr($paytime,0,10);
$paytype = $requestData['purchaseState'];
$transaction_id = $requestData['developerPayload'].'-'.$requestData['purchaseTime'];
$gameOrderId = $requestData['developerPayload'];
$key = "-----BEGIN PUBLIC KEY-----\n".chunk_split($google_public_key, 64,"\n").'-----END PUBLIC KEY-----';
$key