Skip to content
Allie Reilly edited this page Aug 9, 2016 · 8 revisions

About Amazon Login and Pay

The extension adds two components to your Spree Commerce installation:

  • a Login module that allows customers to seamlessly register and login using their Amazon account.
    • This functionality is provided by the spree_social extension and the payment extension, when installed, will include the spree_social extension as a dependency.
  • a Payments module that allows customers to complete checkout using the payment methods in their Amazon account.

You’ll need to create an Amazon Login and Pay merchant account to use with the extension. This account is where you’ll receive payments, see keys you’ll need to configure the extension, view reports, and configure your deposit account.

More information about Amazon Login and Pay, including pricing, can be found at https://payments.amazon.com/merchant. Registration takes just a few minutes, and In most cases, approval is instant.

Login and Pay for Spree Commerce follows standard order and payment flows for the Spree platform. For more information see https://guides.spreecommerce.com/user/ on how to manage your orders and payment state in Spree commerce.

Note: Amazon Login and Pay is not the same as Checkout by Amazon (CBA) or Amazon Flexible Payment Service (FPS). If you have accounts with either of these older services, you’ll still need to register for a new Login and Pay account to use this service.

Installing the Extension

In order to install the extension, you’ll first need to ensure that you meet the following prerequisites:

  • You’re using Spree Commerce version XXXXXXX
  • SSL is installed on your site and active on your checkout and login pages.

Assuming the prerequisites are met, follow these steps to install the extension:

  1. Add spree_amazon_payments to your Gemfile:
gem 'spree_amazon_payments', github: 'amzn/spree_pay_with_amazon', branch: ‘23stable’
gem ‘spree_social’, github: ‘spreecontrib/spree_social’, branch: ‘23stable’
  1. Bundle your dependencies and run the installation generator:
bundle
bundle exec rails g spree_amazon_payments:install
bundle exec rails g spree_social:install
  1. Be sure to answer ‘Y’ to any installation prompts about running db migrations.

Registering Your Site

You will need to create an Amazon Payments account and register your site with this extension. There is a special sign up link for associating your account to Spree Commerce

image

From there, follow these steps:

  1. Click the Get Started! button to start the process.
  2. On the Welcome screen enter your Legal Name, click the User Agreement checkbox, and then click the Continue button.

image

  1. On the next screen, there are several fields to fill out:
  • Application Name: Enter the name of your website that you’d like displayed when a consumer logs in.
  • Application Description: Enter a brief description of your site, if desired.
  • Privacy Notice URL: Enter the URL of your site’s privacy policy, which will be displayed the first time a user logs in using Amazon on your site.
  • Allowed login domains: Enter the secure domain of any domain names you’ll be operating your site on, including any testing or staging environments. Be sure to include any variations of the sub-domain, such as: https://yourstore.com/, https://www.yourstore.com/, https://store.yourstore.com/.
  1. Click the Submit button.
  2. The Summary of Amazon Payments Registration Information has all of the keys you need to connect the extension with your Amazon account—keep them handy. NOTE: You can always find these keys in your Amazon account dashboards, as well.
  3. Click the Continue to Seller Central button to finish your registration and complete your store setup.
  4. If you would like your store’s logo to appear on the Amazon Login screen:
  • Make sure ‘Login with Amazon’ is selected from the pull-down at the top of the page.
  • At the bottom of the Application Information section, click the Edit button.
  • Next to Logo Image, click the Choose File button and select a 150px by 150px PNG image of your logo.
  • Click the Save button to save your changes.
  1. Next, you’ll need to flesh out your store details:
  • Select one of the ‘Amazon Payments Advanced’ options from the pull-down at the top of the page. (Doesn’t matter which.)
  • From the Settings menu in the upper-right corner, select Account Info.
  • Fill out the Seller Information section, which is used for customer-facing emails.
  • In the Legal Entity section, you’ll need to supply your tax identity information. (Click the Launch Interview Wizard link, if you haven’t supplied this information already.)
  • In the Deposit Method section, click the Add button to the right to add your bank account you your seller account.
  1. Once you’ve filled everything out, head back to the Magento admin page to configure the extension.

Configuring the Extension

Setting up Amazon Login & Pay allows your customers to login with their Amazon credentials and use any payment methods or contact information they have stored in their Amazon account. You can configure Login & Pay from the Spree administrative pages

Lets start by logging into you Spree admin

image

You can access your Amazon configuration through the Configuration tab in your Spree dashboard

Click Configuration to start

image

Configuring Login with Amazon

Login with Amazon allows you to let Amazon users login to your site using their Amazon credentials. Lets start by adding Amazon as a Social Authentication Method

From the configuration screen, click Social Authentication Methods * *this requires that you have installed the spree_social gem

image

From the next screen, you will need to add a new authentication method, start by clicking the New Authentication Method button in the top right

image

The next screen lets you add an authentication provider, select Amazon from the drop down list

image

On this screen you will need to add your keys for Login with Amazon that can be found in your seller central account at seller.amazoncentral.com. See instructions later in this guide for where to get the appropriate keys for these settings.

image

Here you can enter your API KEY and API SECRET. These values correspond to your Login with Amazon Client ID and Client Secret in Seller Central

image

Enter your values for these keys, select the environment you wish to target with this added social authentication method and select whether it should be enabled immediately by setting Active to yes or no. At this point, your site will allow users to login to your site using their Amazon account.

What does this mean? Now, when buyers login to your site using their amazon account, an account will be created in the Users table in your Spree backend. This will tie orders to this user and capture their email address should you want to market to them at a later date

Configuring Amazon Payments

To add Amazon as a payment method, you will need to add Amazon as a new payment method under Payment Methods in your Spree configuration and the appropriate keys.

Adding a Payment Method

To begin, select Payment Methods from the right sidebar in your Spree administration page. image

Next, click the New Payment Method button in the top right. From the drop down list select Spree::Gateway::Amazon. image

image

On this configuration page you will need to specify:

  • Name - a common name for this payment method.
  • Description - a description for this payment method
  • Environment - the environment you are targeting
  • Display - where you would like Amazon Payments to be used, available values are:
    • Both - show on front and back end (to buyers and administrators)
    • Front End - only show on the front end and disable any backend functionality. This option should not be used
    • Back End - do not show buyers the Pay with Amazon button on checkout, but provide the ability to manage captures and refunds on the back end. Useful for testing purposes or when protecting buyers from accidentally using Amazon Payments before you are ready
  • Auto Capture
    • If set to yes, the funds will be captured at the time of purchase.
  • Active - Disables the functionality completely.

When finished, click Create to save the new payment method. After creating initially Amazon client information fields will be available.

image

These are:

  • Server
    • This should be either test or live depending on where you are running the plugin
  • Test Mode
    • A flag for setting a sandbox mode in the Amazon Payments plugin that allows you to perform test orders without capturing real funds. You will need to create test buyer accounts associated with your Amazon Payments account in Seller Central. See this video for more information on test buyer accounts.
  • Client ID
    • The Login with Amazon client id. Amazon Payments requires this for authentication of buyers even if Amazon is not added as a social authentication method
  • Merchant ID
    • Your Amazon Payments merchant/seller id. See later in this guide on how to register for a payments account and/or login to sellercentral.amazon.com to retrieve your keys
  • AWS Access Key ID
    • Your Amazon Marketplace Webservices access key. This can be found at sellercentral.amazon.com.
  • AWS Secret Access Key
    • The companion secret key also found at Seller Central. See later in this guide for more information.

Getting your Amazon keys from Seller Central

Amazon Client ID Lets start by getting your AMAZON CLIENT ID. Start by logging into your Seller Central account.

From your Seller Central dashboard, make sure that ‘Login with Amazon’ is selected from the pull-down at the top of the screen.

image

Under the Web Settings heading, you’ll find the Client ID and Client Secret (which you can reveal by clicking the Show Secret button).

Copy the Client ID to the AMAZON CLIENT ID field into your Amazon Payment Method.

Amazon Merchant ID From your Seller Central dashboard, select either Amazon Payments Advanced (Production View) option from the top pull-down.

image

From the Settings menu in the upper-right, select Integration Settings.

image

At the top of the page, you’ll see Your Merchant ID

image

Copy the Merchant ID into your Amazon Payment Method for AMAZON MERCHANT ID

Amazon MWS Access Key/Secret Key

Your AMAZON MWS ACCESS KEY and AMAZON MWS SECRET KEY are available from the same Amazon Payments Advanced (Production View) drop down option. From the top navigation bar of Seller Central, mouseover Integration on the left-hand side, and select MWS Access Key from the drop-down menu.

image

On this page, you’ll see Your Access Key ID and Your Secret Access Key (again, click +Show to reveal it). Copy these values into your mazon Payment Method's fields for MWS ACCESS KEY ID and MWS SECRET KEY & save.

image

Next log into Seller Central and select Amazon Payments Advanced (Production View) from the drop down. From the Settings menu in the upper-right, select Integration Settings.

image

In the Instant Notification Settings section, click the Edit button.

image

Paste the URL you copied into the Merchant URL field

image

Using Login and Pay for this Extension

Overview of the buyer experience

Having Amazon’s Login and Pay for Spree Commerce on your site means that buyers who have an Amazon account can login to your site as registered users and/or pay with their Amazon account. Lets start by showing you how Login with Amazon is shown to your buyers

Login with Amazon

With Amazon added as a social authentication method buyers will see the following when logging in. Specifically, the social authentication methods you have enabled will be shown under Sign in through one of these services

image

When a customer clicks the Amazon logo, they will be redirected to an Amazon sign in page where they will enter their Amazon credentials for their normal amazon.com account.

image

After logging in, they will be returned to the front page of your site, as a registered and logged in user.

image

In the backend, customer account are captured in the Users table. Buyers who login with Amazon have their email captured automatically regardless of if they complete a checkout.

image

Paying with Amazon

When a buyer uses their Amazon account to purchase items on your Spree Commerce store, they will be able to quickly checkout using the addresses and payment methods already stored in their Amazon account. Lets see what that experience looks like.

After adding some items to the cart, when buyers view the cart they will see a button for Pay with Amazon. The button may say Sandbox in the bottom right corner if Test Mode is enabled.

image

After clicking the Pay with Amazon button, the buyer will be shown a pop-up where they can enter their credentials

image

After logging in successfully, the buyer is taken to a screen to start the checkout where the Amazon Address Book widget and the Wallet widget are shown.

image

These widgets contain all payment methods and shipping addresses used by the buyer. Next, they click the Save and Continue button

Next they confirm their shipping details

image

Clicking Save and Continue again, where they are taken to the order summary page and can place the order. Notice the addresses from the Amazon widgets are displayed here.

image