LokiCheckout_AfterPay

This integration is available in the paid plans for the Loki Checkout. Support for this integration is provided as is, because we are depending upon the original vendor as well. High priority support is only available on an hourly basis.
Integration
Payment
Professional
Standard
PHP 8.2 - 8.5
Magento 2.4.6 - 2.4.9
CSP Yes
Unit Tests 22
Integration Tests 14
Functional Tests 22
PHPStan 3
Magento PHPCS 9
License OSL-3.0
Latest Release 0.0.3

This Magento 2 module is an add-on package to the LokiCheckout. It introduces Afterpay (also known as "Cash App Afterpay" or "Clearpay")

Installation

Install this package via composer:

composer require loki-checkout/magento2-after-pay

Next, enable this module:

bin/magento module:enable LokiCheckout_AfterPay

This module requires the official Afterpay extension (afterpay-global/module-afterpay, including afterpay-global/module-cash-app-pay). Configure Afterpay as usual under Stores > Configuration > Sales > Payment Methods.

Features

  • Afterpay / Clearpay (afterpay): After the shopper clicks Place Order, the Loki Checkout creates an Afterpay checkout and redirects to Afterpay. Afterpay then sends the shopper back to the upstream controller afterpay/payment/capture, which places the order. No order is placed before the payment is approved.

  • Payment schedule widget: Afterpay's square-placement payment-schedule widget and terms are shown under the selected method. The widget only appears for the currencies Afterpay supports (AUD, CAD, GBP, NZD, USD). It is refreshed when the shipping method or coupon code changes the order total.

  • Cash App Pay (cashapp): After Place Order, the shopper goes to a dedicated page (loki_checkout_after_pay/cashapp/pay) that renders the Cash App Pay button. Cash App then returns to the upstream controller cashapp/payment/capture, which places the order.

  • Afterpay Express Checkout: An express button in the "Pay faster with" section. Enable it with Stores > Configuration > Loki Checkout > Afterpay options > Enable Afterpay Express Checkout. It uses the upstream afterpay/express/* controllers. Express orders do not pass the Loki Checkout final step, so the Loki tasks (terms, newsletter) and order events described below do not apply to them.

  • Icons: Afterpay (Clearpay for GBP) and Cash App Pay icons in the payment method list.

  • Loki Checkout tasks: The Afterpay task runs after all other final step tasks (terms, reCAPTCHA, rate limiting), so these checks happen before the redirect. Once Afterpay or Cash App Pay has placed the order, the afterPlaceOrder() method of the other tasks is called. Tasks that keep state in memory between beforePlaceOrder() and afterPlaceOrder() (like the newsletter task) are listed in the replayedTasks argument of LokiCheckout\AfterPay\Plugin\RunCheckoutTasksPlugin and run again just before the order is placed.

  • Restrictive CSP: Works with LokiCheckout_Csp (no unsafe-inline or unsafe-eval in the checkout).

See the stories/ folder for the user stories and the tests that cover them.

Development

The package loki-checkout/magento2-after-pay-dev-tools (LokiCheckout_AfterPayDevTools) stubs the Afterpay API. When loki_checkout/after_pay_dev_tools/use_service_stubs is enabled, the redirect goes to a local stand-in page with Approve and Cancel options, so the full order flow can be tested without Afterpay credentials. Never enable it in production.

The Playwright tests also need LokiCheckout_Csp. In Hersir, hersir-additional.sh installs both modules. In production mode, the CSP spec only works when LokiCheckout_Csp was enabled during the static content deploy.

Current status

pipeline success

Support

For getting support, create an Issue under the following project URL:

https://gitlab.yireo.com/loki-checkout/LokiCheckout_AfterPay.git

Configuration Options

The following options of this module can be configured via the Store Configuration:

Afterpay options > Enable Afterpay Express Checkout
loki_checkout/after_pay/express_checkout_enabled
Show the Afterpay Express Checkout button in the fast checkout section of the Loki Checkout.
Loki Components

The following LokiComponents are created or references in this module:

loki-checkout.payment.methods.afterpay.additional loki-checkout.shipping.methods loki-checkout.sidebar.coupon_code
Module Dependencies

The following dependencies are declared in the module its `etc/module.xml` file:

Afterpay_Afterpay Afterpay_CashApp Hyva_Checkout LokiCheckout_Core Loki_Base Loki_Components Loki_CssUtils Loki_FieldComponents Magento_AdminNotification Magento_Authorization Magento_Backend Magento_Catalog Magento_CatalogGraphQl Magento_CatalogInventory Magento_Checkout Magento_CheckoutAgreements Magento_Cms Magento_Config Magento_Csp Magento_Customer Magento_Directory Magento_Eav Magento_EavGraphQl Magento_GraphQl Magento_GraphQlResolverCache Magento_Indexer Magento_MediaGalleryUiApi Magento_Newsletter Magento_Payment Magento_Quote Magento_QuoteGraphQl Magento_Rule Magento_Sales Magento_SalesRule Magento_SalesSequence Magento_Search Magento_Shipping Magento_Store Magento_StoreGraphQl Magento_Tax Magento_Theme Magento_Ui Magento_User Magento_Variable Magento_Vault Magento_Weee Magento_Widget Yireo_CspUtilities
Composer details
Magento module name
LokiCheckout_AfterPay
Composer name
loki-checkout/magento2-after-pay
Composer version
0.0.3
Default branch
main
Requirements
afterpay-global/module-afterpay: ^5.4
afterpay-global/module-cash-app-pay: ^5.0
ext-pcre: *
loki-checkout/magento2-core: ^2.0
loki/magento2-components: ^2.10
loki/magento2-css-utils: ^1.1
magento/framework: ^103.0
magento/module-backend: ^102.0
magento/module-checkout: ^100.4
magento/module-config: ^101.2
magento/module-payment: ^100.4
magento/module-quote: ^101.2
magento/module-sales: ^103.0
magento/module-store: ^101.1
php: >=8.2 <8.6
psr/log: ^1.0 || ^2.0 || ^3.0
Releases
0.0.3 11 November 2026
0.0.2 11 November 2026
Changelog

[0.0.3] - 09 November 2026

Fixed

  • Cover the full Afterpay Express Checkout flow
  • Cover excluded categories and Express button restrictions
  • Add user stories and document the checkout task handling
  • Refresh the Afterpay payment schedule when the order total changes
  • Run the remaining final step tasks once Afterpay has placed the order
  • Create the Afterpay checkout with the masked quote ID
  • Add Magento_Payment dependency, remove duplicate framework requirement and bound Magento module versions

Added

  • Dispatch the onepage order events after Afterpay places the order
  • Add en_US translation file

[0.0.2] - 03 November 2026

Added

  • Afterpay redirect payment: create the Afterpay checkout in the final step and redirect to Afterpay
  • Afterpay payment-schedule widget and terms below the payment method
  • Cash App Pay payment page
  • Afterpay Express Checkout button in the fast checkout section
  • Afterpay, Clearpay and Cash App Pay icons

Last modified: August 6, 2026