View on GitHub

Amazon Pay SDK Samples

Amazon Pay

Download this project as a .zip file Download this project as a tar.gz file

Test Login

This is a test log in to show how quickly customers can login or create an account.

Note: This is a sandbox and does not use actual Amazon accounts. You can use the following credentials.

Email address:
Password:      test123


Create the button container.

<div id="AmazonLoginButton"></div>

Add script to set the client Id.

<script type='text/javascript'>
    window.onAmazonLoginReady = function () {

Import widgets javascript. This must be loaded after you set the client Id above.

<script type='text/javascript' src=''></script>
<script type='text/javascript' src=''></script>
<script type='text/javascript' src=''></script>

Render the button. Note: You will need to add your domain to 'Allowed JavaScript Origins' in Seller Central. If you are testing locally you can use 'http://localhost'. Production sites must have a valid certificate and use https.

<script type='text/javascript'>
    var authRequest;
    OffAmazonPayments.Button("AmazonLoginButton", "MERCHANT_ID", {
        type: "LwA",
        color: "Gold",
        authorization: function () {
            loginOptions = { scope: "profile postal_code payments:widget payments:shipping_address", popup: true };
            authRequest = amazon.Login.authorize(loginOptions, "");
        onError: function (error) {
            // something bad happened