Cartthrob Amazon Pay

Carthrob Amazon Pay makes it simple for your ExpressionEngine store to accept payments through Amazon Pay, right alongside your existing CartThrob setup. Give your customers the ease and trust of checking out with their Amazon account, while you keep all the flexibility and power of CartThrob. Installation is straightforward, integration is seamless, and your shoppers enjoy a faster, more familiar checkout that helps boost conversions and sales.

Buy Now

CartThrob Amazon Pay

Allows for CartThrob checkout using the Amazon Pay system.

You'll need an Amazon Seller Account to use this payment gateway.

Features

Outputs the Amazon Pay button / widget to allow checkout through Amazon Pay.

Considerations

  1. At this time, the Gateway is configured to use templates at amazon/review and amazon/checkout. Be sure to set those up.
  2. Changes to both Shipping and Payment MUST come from Amazon. Changes to either of those within the site will NOT be sent to Amazon.

Intended Flow

Amazon Pay takes full control over the checkout process. The site MUST follow the below flow for optimal use

  1. Click Button
  2. Log into Amazon,
  3. Approve site access
  4. Sent to amazon/review
  5. Approve and/or change details on amazon/review
  6. Upon approval, the user is sent to amazon/checkout
  7. amazon/checkout is a standard CartThrob checkout page with some extra elements (see below).

installation

You install Amazon Pay Payment Gateway just like any other ExpressionEngine Add-ons:

  • Unzip the Add-on archive:
  • Copy the cartthrob_amazon_pay folder to your ExpressionEngine site's ./system/user/addons/ directory.
  • On the Add-Ons page, find CartThrob Amazon Pay Payment Gateway in the list, and click Install.

Configure

Upon installation, you'll need to configure the Add-on through the CartThrob Payments section.

  • Be sure to enable the gateway through the CartThrob configureation
  • You can configure for both Sandbox and Production and toggle just like every other Payment Gateway

Template Tags

payment_button

Displays the Amazon Pay button through a simple single tag.

Example

Usually placed on the original checkout template

{exp:cartthrob_amazon_pay:payment_button}

confirm_payment_form

Generates a form to tell Amazon the user has confirmed the configured payment options.

Params
  • return Where to send the user upon successully letting Amazon know
  • class The CSS class to attach to the form
  • form_id The id attribute to attach to the form; defaults to confirm_payment_form
Example
{exp:cartthrob_amazon_pay:confirm_payment_form return="amazon/checkout"}
    <input type="submit" value="Confirm Payment Details">
{/exp:cartthrob_amazon_pay:confirm_payment_form}
Optional JavaScript

Usually implemented on amazon/review...

Using the below will allow place a button that, when clicked, will open a window allowing changes to the selected options

<input type="button" value="Change Details" id="amazon_change_details"">
<script src="https://static-na.payments-amazon.com/checkout.js"></script>
<script type="text/javascript" charset="utf-8">
    amazon.Pay.bindChangeAction('#amazon_change_details', {
    amazonCheckoutSessionId: '{checkout_session_id}',
    changeAction: 'changeAddress'
    });
</script>

shipping_payment_details

Outputs the values from Amazon for the various payment details like addresses and name

Variables
  • checkout_session_id The ID used by Amazon for the session (rarely needed)
  • first_name
  • last_name
  • amazon_email `address
  • address2
  • city
  • state
  • zip
  • country_code
  • phone
  • shipping_first_name
  • shipping_last_name
  • shipping_address
  • shipping_address2
  • shipping_city
  • shipping_state
  • shipping_zip
  • shipping_phone
  • shipping_country
  • payment_preference
  • created
  • expiration
  • 'amazon_checkout_hidden_fields' Contains the above as a string of hidden fields for use

Todos

  1. Update views/form_extra.php to use value from the algorithm setting value (line 18)
  2. Allow for style of the button color; implemented within above form_extra.php
  3. Update src/Cartthrob_amazon_pay.php to allow for configuration of checkoutReviewReturnUrl value; it's hardcoded for amazon/review