AbanteCart Community

AbanteCart Development => Customization help => Topic started by: flyn on November 24, 2014, 11:56:24 AM

Title: Amazon Login and Pay
Post by: flyn on November 24, 2014, 11:56:24 AM
I asked this awhile back I believe but I will ask here. Is there a way to get this to work with the cart system?

They provide code snippet like below. I just have to change and put our account info in there. I want to test this at least.

What file should I edit to test this on the cart and where in the file should I place this?

Thank You

<head>
  <script type='text/javascript'>
    window.onAmazonLoginReady = function() {
      amazon.Login.setClientId('YOUR_CLIENT_ID_HERE');
    };
  </script>
  <script type='text/javascript'
src='https://static-na.payments-amazon.com/OffAmazonPayments/us/js/Widgets.js?sellerId=YOUR_SELLER_ID_HERE'>
  </script>
</head>

<!-- Place this where you would like the Payment Button to appear -->
<div id="AmazonPayButton"></div>
<script type="text/javascript">
  var authRequest;
  OffAmazonPayments.Button("AmazonPayButton", "YOUR_SELLER_ID_HERE", {
    type:  "PwA",
    color: "Gold",
    size:  "medium",
    useAmazonAddressBook: true,
    authorization: function() {
      var loginOptions = {scope: 'profile payments:widget'};
      authRequest = amazon.Login.authorize(loginOptions, "YOUR_REDIRECT_URL_HERE");
    },
    onError: function(error) {
      // Write your custom error handling
    }
  });
</script>
                 
Title: Re: Amazon Login and Pay
Post by: abantecart on December 01, 2014, 11:09:00 AM
You can try to put this to head.tpl

https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default_html5/template/common/head.tpl