有亚马逊付费小工具整合的问题。我正在尝试加载地址簿小工具。这是带有登录按钮和小部件的页面代码:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script type='text/javascript'>
window.onAmazonLoginReady = function() {
amazon.Login.setClientId('amzn1.application-oa2-client.96328af648a14ee984ff2529df2906b2');
amazon.Login.setUseCookie(true);
};
window.onAmazonPaymentsReady = function() {
showButton();
};
</script>
<script async="async" src='https://static-fe.payments-amazon.com/OffAmazonPayments/jp/js/Widgets.js'>
</script>
</head>
<body>
<div id="AmazonPayButton"></div>
<a href="#" id="Logout">Logout</a>
<div id="addressBookWidgetDiv" style="height: 400px;"></div>
<script type="text/javascript">
function showButton() {
var authRequest;
OffAmazonPayments.Button("AmazonPayButton", "AC0ND72N3R7GI", {
type: "LwA",
color: "Gold",
size: "medium",
authorization: function () {
loginOptions = {
scope: "profile",
popup: true
};
authRequest = amazon.Login.authorize(loginOptions, function(){
new OffAmazonPayments.Widgets.AddressBook({
sellerId: 'AC0ND72N3R7GI',
onOrderReferenceCreate: function(orderReference) {
},
design: {
designMode: 'responsive'
},
onError: function(error) {
console.log(error.getErrorCode() + ': ' + error.getErrorMessage());
}
}).bind("addressBookWidgetDiv");
});
},
onError: function (error) {
console.log("The following error occurred: "
+ error.getErrorCode()
+ ' - ' + error.getErrorMessage());
}
});
}
</script>
<script type="text/javascript">
document.getElementById('Logout').onclick = function() {
amazon.Login.logout();
};
</script>
</body>
</html>
登录弹出窗口正常显示,但小部件没有加载以下错误:
买方与亚马逊的会话已过期。买家必须先登录 你渲染小部件。
如果我切换到沙盒环境并使用测试帐户,也会发生同样的错误。 (请注意,我使用日文版的widgets.js插件,因为卖家帐户位于日本地区)。期待一些帮助,谢谢。