Cookie Consent by Free Privacy Policy Generator Update cookies preferences

Aero Commerce

This module adds the Clearpay payment gateway into your Aero Commerce application. The driver supports immediate and delayed capture of funds, along with refunding through your Aero Commerce admin.

Pre-requisites

Before you install the module, contact Clearpay and ask for your sandbox credentials. Once you have these credentials, add them to your .env as follows:

CLEARPAY_SANDBOX_MERCHANT_ID=your Clearpay sandbox Merchant ID
CLEARPAY_SANDBOX_SECRET_KEY=your Clearpay sandbox secret key
CLEARPAY_TEST_MODE=true for test mode/by default, false for a live site

Installation

Once you have the required credentials in place, do the following:

  1. Install the module:
composer require aerocommerce/clearpay
  1. The module includes a task which will be scheduled (see below). But for the first time only you need to run it manually to retrieve the account per-order limits from Clearpay:
php artisan clearpay:get-configuration
  1. Once the module has been installed, you can create a payment method in your admin at Configuration > Payment Methods > New Payment Method. Ensure the driver is set to clearpay and the Available box is checked.

Configuration

Deferred payments

By default, Clearpay will charge the customer immediately once their order is confirmed. You can instead defer these charges and capture them manually instead. To do this:

  1. Set the following in your .env:
CLEARPAY_DEFER=true

or by check the Require manual capture of funds box at Settings > Clearpay in your admin.

❗️

Warning

In production, all capture requests must be complete within 13 days of the order placement date. Any remaining amounts are automatically voided after this, and the customer's instalments updated to reflect the remaining amount.

Minimum / maximum order values

There is a task configured to run daily that queries Clearpay for the minimum and maximum order values they accept on your account. Clearpay use this information to decide whether Clearpay appears to your customers as a payment option during checkout.

To ensure this task can run:

  1. Ensure you have the Laravel task scheduler configured. The default time of this module's scheduled task is midnight. To change this time add this line to your .env:
CLEARPAY_CRON="0 0 * * *"

📘

Override

The numbers retrieved from this request can be overridden by the Aero Commerce admin. To do this navigate to Settings > Clearpay and set the minimum/maximum spend. But you must stay within the Clearpay-supplied values.

Shipping information

You can send shipping information to Clearpay whenever an order is fulfilled through the Aero Commerce admin. To enable this:

  1. Check the Send fulfilment info to Clearpay box on the settings screen or add this to your .env:
CLEARPAY_SHIPPING=true
  1. You can also specify the priority of a fulfilment method when sent to Clearpay. To do this add an additional attribute to the fulfilment method. This attribute is called clearpay_priority and has a value of either STANDARD or EXPRESS.

Product Availability

A product is eligible for Clearpay if the sale price falls within the limits configured on your Clearpay account. The final order total must also fall within this value in order for Clearpay to appear during checkout.

Clearpay do not allow customers to buy certain types of product. Contact us for a list of these prohibited products and services.

If one or more of your products is prohibited by Clearpay, you must disable Clearpay for these products. To do this disablement you add a tag that can be applied to a product or variant. You can tag a manufacturer that disables all products from that manufacturer. You can also tag a category that disables all products within that category and any child categories.

For example, if you already have an Internal Tags or similar group, you could add a Disable Clearpay tag to this. If you need to add a new tag, follow these steps:

  1. Navigate to Catalog Management > Tags and either click to enter an existing Tag Group, or click the New Tag Group button.
  2. Fill in the name for this tag group (if new) and ensure This tag group can appear in the listing filters is unchecked.
  3. Click New Tag and give a descriptive name for this tag that makes it clear that it will disable Clearpay when applied.
  4. Once you have the tag in place, go to Settings > Clearpay and set Disable using this tag to your new tag before you click Save. This stops the messaging widget appearing on the product page. It also removes Clearpay as a payment option at checkout if any ineligible products are in the cart.

Clearpay Messaging Widget

To ensure Clearpay's messaging widget can be displayed wherever called, do the following:

  1. Add this JavaScript to your <head> tag:
<script src="https://js.afterpay.com/afterpay-1.x.js" async></script>

If a product is eligible for Clearpay, a variable eligibleForClearpay is set to true on your product page. You can add a section to display the appropriate messaging by wrapping it inside an if.

The variables clearpayBadgeTheme and clearpayModalTheme are also be exposed to your product page. Include these in any messaging widgets displayed. This ensures consistent theming across your site.

Use the example below to help you. The product price should be wrapped inside a span or similar tag with a selector that can be specified in data-amount-selector. This allows the widget to update as product options are changed.

<span id="salePrice">{{ "{{ sale_price.inc }}" }}</span>
...
{% if eligibleForClearpay %}
    <afterpay-placement>
        id="afterpayWidget"
        data-locale="en_GB"
        data-currency="GBP"
        data-amount-selector="#salePrice"
        data-badge-theme="{{ clearpayBadgeTheme }}"
        data-modal-theme="{{ clearpayModalTheme }}"
    </afterpay-placement>
{% endif %}

For more information about what you might want to display here, see the Clearpay Messaging Widget page.

Going Live

Once Clearpay are happy for you to go live and have supplied you with your live credentials, to the following:

  1. Update your .env or settings:
CLEARPAY_LIVE_MERCHANT_ID=your Clearpay live Merchant ID
CLEARPAY_LIVE_SECRET_KEY=your Clearpay live secret key
  1. Finally, change your .env to CLEARPAY_TEST_MODE=false.

📘

Supported Countries

Clearpay is available for Aero Commerce merchants with a store address in these countries:

🇬🇧 UK