0

在没有地址引用文档的情况下实施亚马逊支付小部件 https://developer.amazon.com/docs/eu/amazon-pay-onetime/no-address-widget.html

将clientid和sellerid替换为卖家中心注册的应用程序值,但出现错误“您不能使用与您的卖家账户关联的用户名和密码。请使用其他买家账户。”

这是使用的代码

<script type='text/javascript' 
    src='https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js'>

<script>
  window.onAmazonLoginReady = function() { 
    amazon.Login.setClientId('yyyyyyyyy'); 
  };
</script>


<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0"/>

<!-- Place this code in your HTML where you want the -->
<div id="walletWidgetDiv">
</div> 

<script>
  var orderReferenceId = null;

  new OffAmazonPayments.Widgets.Wallet({ 
    sellerId: 'xxxx',
    // Add the onOrderReferenceCreate function to 
    // generate an Order Reference ID. 
    onOrderReferenceCreate: function(orderReference) {
      // Use the following cod to get the generated Order Reference ID.
      orderReferenceId = orderReference.getAmazonOrderReferenceId();
    },
    design: {
      designMode: 'responsive'
    },
    onPaymentSelect: function(orderReference) {  
      // Replace this code with the action that you want to perform
      // after the payment method is selected.

      // Ideally this would enable the next action for the buyer
      // such as a "Continue" or "Place Order" button.
    },
    onError: function(error) {
      // Your error handling code.
      // During development you can use the following
      // code to view error messages:
      // console.log(error.getErrorCode() + ': ' + error.getErrorMessage());
      // See "Handling Errors" for more information.
    }
  }).bind("walletWidgetDiv");
</script>

4

2 回答 2

0

通过将 clientid js 先放在从 https://developer.amazon.com/docs/amazon-pay-onetime/add-widgets.html读取的内容,解决了错误消息。

但是,现在没有显示,只有空白屏幕。

于 2019-10-24T07:18:52.580 回答
0

您使用相同的电子邮件地址作为用户登录您的沙盒环境,而不是作为客户登录您的卖家中心账户。

出于测试目的,您可以在卖家中心账户中创建一个新的沙盒买家账户。

本文档应该可以帮助您实现这一目标。还有一个视频逐步显示该过程。

于 2019-10-24T06:21:31.777 回答