「Unity/課金/リモートレシート検証/phpサーバ」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==phpで検証== <pre> $receiptJson = '{"orderId":"xxxxxx","productId":"xxxxxx",...}'; $signature = base64_decode('xxxxxxxxxx'); // 下記のURLなどを参考にpem形...」) |
(相違点なし)
|
2025年3月18日 (火) 11:48時点における版
phpで検証
$receiptJson = '{"orderId":"xxxxxx","productId":"xxxxxx",...}';
$signature = base64_decode('xxxxxxxxxx');
// 下記のURLなどを参考にpem形式に変換
// FYI: http://php.net/manual/ja/ref.openssl.php
$publicKey = der2pem(base64_decode('xxxxxxxxxx'));
if (openssl_verify($receiptJson, $signature, openssl_get_publickey($publicKey)) === 1) {
// 検証ok
}
