我已经实施了在 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:代码中的任何位置也不是定义协议。任何建议都会受到赞赏,谢谢!

更新:

它与样本在使用“doc”语法中有关的事情,以在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>
.

但现在给出更模糊的错误。

有帮助吗?

解决方案

对话框错误,例如“购买设置中存在错误”,具有返回给客户端故障处理程序的相应错误代码:

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

在您的情况下,错误代码是Merchant_Error,它指示一个严重格式的JWT。这可能是由于使用不正确的卖方密钥或秘密来签署JWT。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top