0

I am integrating the amazon pay API in my asp.net code. I have write the following code

<!-- language: lang-js -->
<script type='text/javascript'>
    window.onAmazonLoginReady = function () {
        amazon.Login.setClientId('<%=ConfigurationManager.AppSettings["lwa_client_id"]%>');
        amazon.Login.setUseCookie(true);
    };
                        </script>
<script async type='text/javascript' src='https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js'></script>
<script type='text/javascript'>
    OffAmazonPayments.Button("AmazonPayButton", '<%=ConfigurationManager.AppSettings["merchant_id"]%>', {
        type: "PwA",
        authorization: function () {
            debugger;
            loginOptions = { scope: "profile postal_code payments:widget payments:shipping_address", popup: true };
            amazon.Login.authorize(loginOptions, "/AmazonProcessing");
        },
        onError: function (error) {
            // something bad happened
        }
    });
 </script>

It render the Amazon Pay button. But when I click on it, It will show the popup with error of 404.

enter image description here

It was working before. I do not change any setting on the Amazon. I have checked the JavaScript Cross origin. I have added the localhost with port. How to resolve this issue?

James Z
  • 12,104
  • 10
  • 27
  • 43

1 Answers1

1

The value for client ID is probably not populated correctly from your application settings (error "Unknown client_id" and in the error summary "client_id=undefined").

You should be able to set a breakpoint in the JavaScript on the line with "setClientId" to verify whether the client ID has a value or not.

Daniel Lemke
  • 1,377
  • 14
  • 22