Google Walletのサンプルファイルを使用するとエラーが発生します
-
21-12-2019 - |
質問
https://code.google.com/にあるサンプルコードを実装しましたP / IAP-PHP / マイテストサイト http://whatisthesite.com 。「購入」ボタンをクリックすると、曖昧なエラーメッセージが表示される可能性があるように:
There is an error in the setup for your purchase. Please contact the merchant with this error message: Expected 3 components in jwt: $jwtToken
.
コンソールは次のようになります。
Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://whatisthesite.com" from accessing a frame with origin "https://sandbox.google.com". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.
markdown-here.js:33
findFocusedElem markdown-here.js:33
intervalCheck
.
デモサイト http://iap-php.appspot.com/ はhttpsではありません。プロトコルを定義するためのコード内のどこにもありません。あらゆるアドバイスが理解されるでしょう、ありがとう!
更新:
JS関数でインラインPHP変数を使用するには、サンプルの「こちらのdoc」構文の使用と関係があるものがあります。この構文を変更しました:
echo <<< INDEX <button id='runDemoButton' value='buy' class='buy-button' onclick='DemoButton("$jwtToken");'><b>Purchase</b></button> INDEX;
.
これに:
<button id='runDemoButton' value='buy' class='buy-button' onclick='DemoButton("<?php echo $jwtToken;?>");'><b>Purchase</b></button>
.
しかし今さらにあいまいな誤差を与えます。
解決
「購入のセットアップにエラーがある」などのダイアログエラーには、クライアント側の障害ハンドラに返されたエラーコードがあります。
https://developers.google.com/wallet/digital/docs/JSReference#失敗ハンドラー
あなたの場合のエラーコードは、ひどくフォーマットされたJWTを示すMerchant_Errorです。これは、誤った売り手の鍵や秘密がJWTに署名することが原因である可能性があります。
所属していません StackOverflow