我在我的測試網站http://whatisthesite.com上實施了https://code.google.com/p/iap-php/處的示例代碼。正如你或許能看到有一個模糊的錯誤消息,曾經的「購買」按鈕被點擊:使用Google電子錢包的示例文件給出錯誤
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:也不是在代碼中的任何地方定義協議。任何意見將不勝感激,謝謝!
UPDATE:
它有事情做與樣品的使用「這裏文件」語法的JS函數中使用內聯PHP變量。改變了這句法:
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>
但現在給出了一個更明確的錯誤。
你使用_sandbox_帳戶(祕密/ ID)? – EdSF
這就是問題!沙箱ID與生產ID相關。感謝您讓我擺脫我自己的頭腦@EdSF – BenRacicot