0

Implementing amazon pay widget without address referring doc https://developer.amazon.com/docs/eu/amazon-pay-onetime/no-address-widget.html

Replaced the clientid and sellerid with the registered application values from seller central, but getting error as "You cannot use the username and password associated with your seller account. Please use a different buyer account."

This is the code used

<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>
user40991
  • 173
  • 1
  • 3
  • 11

2 Answers2

0

You are using the same email address to login as a user to your sandbox environment than you use for the login as customer in to your seller central account.

For you testing purposes you can create a new sandbox buyer account in your seller central account.

This documentation should help you to accomplish that. There is also a video showing the process step by step.

osanger
  • 2,276
  • 3
  • 28
  • 35
  • Have created the test buyer account using that logged in as in the video and a token was received in the redirection url.Code used was https://developer.amazon.com/docs/amazon-pay-onetime/add-a-button.html After that trying to display the widget, but did not understand the link between the logged in step and the widget display as the widget display code did not seems to use the token received anywhere,seems to use the seller and client id(obtained the application registered) and it is throwing the above error message – user40991 Oct 24 '19 at 06:31
0

Resolved the error message by placing the clientid js first as read from https://developer.amazon.com/docs/amazon-pay-onetime/add-widgets.html.

But, now no display, only blank screen.

user40991
  • 173
  • 1
  • 3
  • 11