3

I'm trying to integrate Amazon Payments (Payment only, not login with Amazon) into my site.

I can successfully display the authentication form for the payment:

<div id="AmazonPayButton" />
          @{
              var callbackurl = string.Format("{0}://{1}/Account/AmazonConfirm", Request.Url.Scheme, Request.Url.Authority);
           }
           <script type="text/javascript">
               OffAmazonPayments.Button("AmazonPayButton", "M_MYSELLERID_1234567", {
                   type: "PwA",
                   size: "medium",
                   authorization: function() {
                      loginOptions =
                           {scope: "payments:widget", popup: true };
                      authRequest = amazon.Login.authorize(loginOptions, "@(callbackurl)");
                   },
                   onError: function(error) {
                        alert('We could not connect to Amazon to process your payment, try again later');
                   }
              });
      </script>
</div>

Amazon successful redirects to my callback URL after authentication. But when I try to display the wallet widget with the Same Seller ID, I get an "invalid seller ID" error:

<div id="walletWidgetDiv">
    </div>
    <script>
        new OffAmazonPayments.Widgets.Wallet({
            sellerId: 'M_MYSELLERID_1234567',
            onReady: function(billingAgreement) {
                var billingAgreementId = billingAgreement.getAmazonBillingAgreementId();
            },
            agreementType: 'BillingAgreement',
            design: {
                size : {width:'400px', height:'260px'}
            },
            onPaymentSelect: function(billingAgreement) {
                // Replace this code with the action that you want to perform
                // after the payment method is selected.
            },
            onError: function(error) {
                alert(error.getErrorMessage());
            }
      }).bind("walletWidgetDiv");
    </script>

enter image description here

Why would the authentication work, only to have the Wallet display rejected?

Update @Brent Douglas in his answer triggered me to recheck my seller ID and I had specified an incorrect ID in one of my script references. Now I get the following error:

"the seller ID is not in the appropriate state to execute the request"

Not sure what that means. I checked my account and the deposit/banking info is specified, and nothing else is flagged on the Integration Settings page. Is there anything else in the account that needs to be added/verified? (Other than the typical, web page URL and other info)

4

2 回答 2

2

您需要登录您的卖家中心账户,确保在顶部的下拉菜单中选择“Amazon Payments Advanced”,点击右上角的“设置”,然后点击“集成设置”。在此页面上,您将看到“您的商家 ID”。这是您的卖家 ID。在任何地方用这个卖家 ID 替换 M_MYSELLERID_1234567。

假设您使用的是正确的卖家 ID,您还需要确保在显示钱包小部件的句柄登录页面中包含以下内容。

<!-- since you are using 'popup' -->
<script type='text/javascript'>
    window.onAmazonLoginReady = function () {
        amazon.Login.setClientId('[YOUR_CLIENT_ID]');
        amazon.Login.setUseCookie(true);
    };
</script>

然后,您需要包含 Widgets.js 文件。

对于沙盒模式,您将使用它。

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

对于生产,您将使用它。

<script src='https://static-na.payments-amazon.com/OffAmazonPayments/us/js/Widgets.js'></script>
于 2014-10-21T17:12:15.803 回答
0

我搜索了相同的确切错误,并找到了此链接。

这表明“您需要为 Amazon Payments 使用 SandBox 凭证。”

检查此链接。

于 2014-10-21T17:12:36.287 回答