Thank you for your visit. This page is only available in English at this time.

Step 1: Add a Button widget for buyer authentication

Prerequisite: Complete all requirements in the Prerequisites section before beginning this integration step.

The first widget that you need to embed and present to your buyers is the Amazon Pay button widget. This widget displays the button that lets buyers know that they can use their Amazon credentials (email address and password) to sign in and use Amazon Pay to pay for their order on your site.

Assuming that you have added the necessary JavaScript code in the head section of your website (as described in the Prerequisites section), you can embed the button of your choice by adding the appropriate code. See the sample Amazon Pay button code below:

<div id="AmazonPayButton"/>
<script type="text/javascript">
  var authRequest;
  OffAmazonPayments.Button("AmazonPayButton", "YOUR_MERCHANT_ID ", {

    authorization: function() {
      loginOptions =
        {scope: "ENTER_SCOPES", popup: "ENTER_POPUP_PARAMETER"};
      authRequest = amazon.Login.authorize (loginOptions,
        "YOUR_REDIRECT_URL ");
    onError: function(error) {
      // your error handling code

The code sample above defines the division in your webpage that is used to render the button. Place this code in the HTML where you want the button to appear.

Button widget parameters

When you add the button code to your site, you need to replace parameters in the code sample with your own values. The following sections describe how to replace text in the code sample:

Related code topics:


Replace YOUR_MERCHANT_ID with your own Merchant-ID, which you received during registration. If you are not sure what your Merchant-ID is, log in to Seller Central and go to Integration > MWS Access Key to view your Merchant ID.


The type parameter is an optional parameter for indicating the type of button image that you want to choose for your webpage. Note that if you decide not to specify a value for type, the Login with Amazon button is set as the default value.

The following table shows the valid type parameter values, button descriptions, and sample button images.

Type codes Button description Button example
LwA Specifies the Login with Amazon button.

This is the default button if type is not specified.
PwA Specifies the Amazon Pay button.


The color parameter is an optional parameter for choosing a button color. This table shows the valid color code values, color descriptions, and color samples.

Color codes Color description Color example
Gold Gold (default)
LightGray Light gray
DarkGray Dark gray


The size parameter is an optional parameter for choosing a button size. For more information about button size options, see the Button guidelines.

Valid size code values are:

Regular Retina
  • small
  • medium (default)
  • large
  • x-large

The actual size rendered depends on the type of button selected:

Parameter Type Size
LwA - Specifies the Login with Amazon button.
  • small (156px x 32px)
  • medium (174px x 46px)
  • large (312px x 64px)
  • x-large (390px x 92px)
PwA - Specifies the Amazon Pay button.
  • small (148px x 30px)
  • medium (200px x 45px)
  • large (296px x 60px)
  • x-large (400px x 90px)


The value of the parameter scope that you choose influences both the content returned in the response of the call and the type of consent screen Amazon Pay shows to the buyer to secure their permission for sharing their information.

You may use a combination of the following scope parameters:

Scope parameter Description Requirements
profile Gives access to the full user profile (username, email-address, user-id) after login.  
profile:user_id Gives access only to the user-id from the user profile after login.  
postal_code Gives the user's zip/postal code number from their primary shipping address. When you request access to the postal_code scope, alone or in concert with the profile or profile:user_id scope, the user has to consent to share their information.
payments:widget Required to show the Amazon Pay widgets (address and wallet widget) on your page. If used without the parameter below, it gives access to the full shipping address after ConfirmOrderReference call.  
payments:shipping_address Gives access to the full shipping address via the GetOrderReferenceDetails API-Call as soon as an address has been selected in the address widget. Requires scope parameter payments:widget AccessToken set in GetOrderReferenceDetails call.

Example: scope: profile payments:widget payments:shipping_address

The payments:shipping_address provides access to the buyer's shipping address. To retrieve the full shipping address, you need to call the getOrderReferenceDetails API. For more information, see "Getting the shipping address from Amazon" in Step 2: Add the AddressBook and Wallet widgets or GetOrderReferenceDetails in the Amazon Pay API reference guide.


The popup parameter determines whether the buyer is presented with a pop-up window to authenticate, or if the buyer is instead redirected to an Amazon Pay page to authenticate.

Use one of the following popup parameters:

  • true - An Amazon Pay authentication screen is presented in a pop-up dialog where buyers can authenticate without ever leaving your website. This value is recommended for desktops where the button widget is presented on a secure page. Note that this option requires that the button resides on an HTTPS page with a valid TLS/SSL certificate.
  • false - The buyer is redirected to an Amazon Pay page within the same browser window. This value is recommended for smartphone optimized devices or if you are rendering the button widget on a non-secure page. Note that the redirect URL must use HTTPS protocol and have a valid SSL certificate. For more information, see Use redirect authentication experience.

Default: popup: true

When you embed an Amazon Pay button with the pop-up parameter set to true, the buyer is asked for their Amazon credentials (email address and password):

As you can see in the previous screenshot, you can add your company logo to the authentication window. You can do this on Seller Central by clicking Settings and then clicking Integration Settings.


The redirect URL is a parameter that determines which page the buyer is redirected to after successfully authenticating. For example, after a successful authentication, you might want to take the buyer to the next page in your checkout pipeline to collect their shipping address and/or payment method details. Note that in case you use "popup:false" in your button code, which means you use the redirect login experience, you have to add all the redirect URLs to an access list for your application. Instructions for adding the redirect URLs to the access list can be found here: Adding allowed JavaScript origins or allowed return URLs

Error handling code

We also recommend that you implement an onError handler in your code. The onError code is optional, but it can save you considerable effort with troubleshooting integration issues. For more information, see Testing your integration in the Sandbox environment .

Adding a logout option

After a user has signed in, you should add a logout option (often a hyperlink) to your website. The logout option should delete any cached tokens and remove the user's profile information (like their name) from your website, and then your website can present the Login button again.

If you are using the Login with Amazon SDK for JavaScript, you can call the amazon.Login.logout method to delete any cached tokens. For example:

<script type="text/javascript">
  document.getElementById('Logout').onclick = function() {

Subsequent calls to amazon.Login.authorize present the login screen, by default.