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/reviewandamazon/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/checkoutis 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_payfolder 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
returnWhere to send the user upon successully letting Amazon knowclassThe CSS class to attach to the formform_idThe 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_idThe ID used by Amazon for the session (rarely needed)first_namelast_nameamazon_email`addressaddress2citystatezipcountry_codephoneshipping_first_nameshipping_last_nameshipping_addressshipping_address2shipping_cityshipping_stateshipping_zipshipping_phoneshipping_countrypayment_preferencecreatedexpiration- 'amazon_checkout_hidden_fields' Contains the above as a string of hidden fields for use
Todos
- Update
views/form_extra.phpto use value from thealgorithmsetting value (line 18) - Allow for style of the button color; implemented within above
form_extra.php - Update
src/Cartthrob_amazon_pay.phpto allow for configuration ofcheckoutReviewReturnUrlvalue; it's hardcoded foramazon/review