Amazon Pay Widget Code Generator

Language :
{{urlCopy}}
Width: Height:
{{script.htmlStart}}
{{script.bodyStart}}
  {{script.buttonDivContainer}}{{script.buttonDiv}}{{script.buttonExplanation}}{{script.buttonDivContainerEnd}}{{script.logoutButton}}
  {{script.addressBookWidgetDiv}}
  {{script.walletWidgetDiv}}
  {{script.consentWidgetDiv}}
  {{script.start}}
    // get access token
    function getURLParameter(name, source) {
        return decodeURIComponent((new RegExp('[?|&|#]' + name + '=' +
                        '([^{{script.amp}};]+?)({{script.amp}}|#|;|$)').exec(source) || [, ""])[1].replace(/\+/g, '%20')) || null;
    }

    var accessToken = getURLParameter("access_token", location.hash);
    if (typeof accessToken === 'string' {{script.amp}}{{script.amp}} accessToken.match(/^Atza/)) {
        document.cookie = "amazon_Login_accessToken=" + accessToken + ";path=/;secure";
    }

    window.onAmazonLoginReady = function() {
      {{script.useCookie}}
      amazon.Login.setClientId("{{awp.crient_id}}");
    };

    window.onAmazonPaymentsReady = function() {
      {{script.showLoginButton}}
      {{script.showAddressBookWidget}}
      {{script.showWalletWidget}}
    };

    document.getElementById('Logout').onclick = function() {
      amazon.Login.logout();
      document.cookie = "amazon_Login_accessToken=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
      window.location.href = '/';
    };
  {{script.end}}

  {{script.start}}
    {{script.showLoginButtonDetail}}
    {{script.showAddressBookWidgetDetail}}
    {{script.showWalletWidgetDetail}}
    {{script.showConsentWidgetDetail}}
  {{script.end}}
  {{script.widgetJS}}
{{script.bodyEnd}}
{{script.htmlEnd}}
Fork me on GitHub