Google 应用内购买结算资料

实现应用内购买结算:

https://developer.android.google.cn/google/play/billing/billing_integrate.html?hl=zh-cn

字段参考:

https://developer.android.google.cn/google/play/billing/billing_reference.html?hl=zh-cn#getBuyIntent

# PHP服务端验证
$inappPurchaseData = Request::input('INAPP_PURCHASE_DATA');
$inappDataSignature = Request::input('INAPP_DATA_SIGNATURE');
$googlePublicKey = 'xxxx'; # google后台能获取到的

$publicKey = "-----BEGIN PUBLIC KEY-----" . PHP_EOL . chunk_split($googlePublicKey, 64, PHP_EOL) .
"-----END PUBLIC KEY-----";

$publicKeyHandle = openssl_get_publickey($publicKey);
$verify = openssl_verify($inappPurchaseData, base64_decode($inappDataSignature), 
$publicKeyHandle, OPENSSL_ALGO_SHA1);

# $verify == 1 则验证通过, 0 表示验证失败