2014-02-25 55 views
0

我在我的測試網站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> 

但現在給出了一個更明確的錯誤。

+1

你使用_sandbox_帳戶(祕密/ ID)? – EdSF

+0

這就是問題!沙箱ID與生產ID相關。感謝您讓我擺脫我自己的頭腦@EdSF – BenRacicot

回答

0

對話框錯誤,如「有一個在安裝您購買的一個錯誤」有一個對應的錯誤代碼返回給客戶端的故障處理程序:

https://developers.google.com/wallet/digital/docs/jsreference#failurehandler

在你的情況下,錯誤代碼爲MERCHANT_ERROR表示格式錯誤的JWT。這可能是由於使用不正確的SELLER KEY或SECRET來簽署JWT。

+0

您指的是控制檯日誌記錄的故障處理程序?是的,也http://stackoverflow.com/questions/17157243/google-wallet-error-the-frame-requesting-access-has-a-protocol-of-https-the?rq=1解決了另一個問題。謝謝@米海 – BenRacicot

相關問題