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 NowCartThrob 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
- At this time, the Gateway is configured to use templates at
amazon/review
andamazon/checkout
. Be sure to set those up. - 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
- Click Button
- Log into Amazon,
- Approve site access
- Sent to
amazon/review
- Approve and/or change details on
amazon/review
- Upon approval, the user is sent to
amazon/checkout
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 knowclass
The CSS class to attach to the formform_id
The id attribute to attach to the form; defaults toconfirm_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
- Update
views/form_extra.php
to use value from thealgorithm
setting value (line 18) - Allow for style of the button color; implemented within above
form_extra.php
- Update
src/Cartthrob_amazon_pay.php
to allow for configuration ofcheckoutReviewReturnUrl
value; it's hardcoded foramazon/review