PHPackages                             craftcms/commerce-sagepay - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. craftcms/commerce-sagepay

ActiveCraft-plugin

craftcms/commerce-sagepay
=========================

Sage Pay integration for Craft Commerce 4.0+/5.0+

5.1.0(2y ago)410.2k↑500%5[6 issues](https://github.com/craftcms/commerce-sagepay/issues)[1 PRs](https://github.com/craftcms/commerce-sagepay/pulls)MITPHPPHP ^8.0.2CI passing

Since Apr 3Pushed 2y ago4 watchersCompare

[ Source](https://github.com/craftcms/commerce-sagepay)[ Packagist](https://packagist.org/packages/craftcms/commerce-sagepay)[ RSS](/packages/craftcms-commerce-sagepay/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelog (1)Dependencies (7)Versions (19)Used By (0)

[![Sage Pay for Craft Commerce icon](./src/icon.svg)](./src/icon.svg)

Sage Pay for Craft Commerce
===========================

[](#sage-pay-for-craft-commerce)

This plugin provides a [Sage Pay](https://www.sagepay.co.uk/) integration for [Craft Commerce](https://craftcms.com/commerce).

> **Tip:** This plugin uses protocol version `4.00` of the API for SagePay/Opayo.

Requirements
------------

[](#requirements)

This plugin requires either:

- Craft 4.0 and Craft Commerce 4.0 or later
- Craft 5.0 and Craft Commerce 5.0 or later

Installation
------------

[](#installation)

You can install this plugin from the Plugin Store or with Composer.

#### From the Plugin Store

[](#from-the-plugin-store)

Go to the Plugin Store in your project’s Control Panel and search for Sage Pay for Craft Commerce”. Then click on the “Install” button in its modal window.

#### With Composer

[](#with-composer)

Open your terminal and run the following commands:

```
# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require craftcms/commerce-sagepay

# tell Craft to install the plugin
./craft install/plugin commerce-sagepay
```

Setup
-----

[](#setup)

To add a Sage Pay payment gateway, go to Commerce → Settings → Gateways, create a new gateway, and set the gateway type to “Sage Pay Server”.

> **Tip:** The gateway settings can be set to environment variables. See [Environmental Configuration](https://docs.craftcms.com/v3/config/environments.html) in the Craft docs to learn more about that.

### Using the legacy basket format

[](#using-the-legacy-basket-format)

Sage Pay has two formats for submit basket data — `Basket` and `BasketXML`. The `Basket` is a legacy format, but is the only way to integrate with Sage 50 Accounts.

To use the legacy format, simply turn on the appropriate setting in the gateway settings. To complete your integration with Sage 50 Accounts you can use the following event:

```
use \craft\commerce\omnipay\base\Gateway as BaseGateway;

Event::on(BaseGateway::class, BaseGatewa::EVENT_AFTER_CREATE_ITEM_BAG, function(ItemBagEvent $itemBagEvent) {

    $orderLineItems = $itemBagEvent->order->getLineItems();

    /**
     * @var $item Item
    */
    foreach ($itemBagEvent->items as $key => $item) {

        if (!isset($orderLineItems[$key])) {
            return;
        }

        $orderLineItem  = $orderLineItems[$key];

        // Make sure that the description and price are the same as we are relying upon the order
        // of the Order Items and The OmniPay Item Bag to be the same
        if ($orderLineItem->getDescription() != $item->getDescription()) {
            return;
        }

        if ($orderLineItem->price != $item->getPrice()) {
            return;
        }

        $sku = $orderLineItem->getSku();

        // Place the SKU within [] as the Product Record for the Sage 50 Accounts Integration
        $description = '[' . $sku . ']' . $item->getDescription();
        $item->setDescription($description);
    }
});
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 50.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~144 days

Recently: every ~176 days

Total

16

Last Release

786d ago

Major Versions

1.2.0 → 2.0.02019-03-04

2.1.1 → 3.0.02021-04-20

3.0.0 → 4.0.02022-03-09

4.0.0 → 5.0.0-beta.12022-04-07

PHP version history (3 changes)4.0.0PHP &gt;=7.3

5.0.0-beta.1PHP &gt;=8.0.2

5.0.0-RC1PHP ^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ccdf8b493035de2343c55bd889513e3af5c04d5823482a2b186ad16adb1c3e3?d=identicon)[brandonkelly](/maintainers/brandonkelly)

---

Top Contributors

[![nfourtythree](https://avatars.githubusercontent.com/u/266453?v=4)](https://github.com/nfourtythree "nfourtythree (64 commits)")[![andris-sevcenko](https://avatars.githubusercontent.com/u/1891118?v=4)](https://github.com/andris-sevcenko "andris-sevcenko (31 commits)")[![angrybrad](https://avatars.githubusercontent.com/u/61869?v=4)](https://github.com/angrybrad "angrybrad (13 commits)")[![lukeholder](https://avatars.githubusercontent.com/u/133571?v=4)](https://github.com/lukeholder "lukeholder (7 commits)")[![brandonkelly](https://avatars.githubusercontent.com/u/47792?v=4)](https://github.com/brandonkelly "brandonkelly (6 commits)")[![timkelty](https://avatars.githubusercontent.com/u/18329?v=4)](https://github.com/timkelty "timkelty (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![MakeilaLundy](https://avatars.githubusercontent.com/u/19892516?v=4)](https://github.com/MakeilaLundy "MakeilaLundy (1 commits)")[![billythekid](https://avatars.githubusercontent.com/u/330170?v=4)](https://github.com/billythekid "billythekid (1 commits)")[![benjamindavid](https://avatars.githubusercontent.com/u/2911900?v=4)](https://github.com/benjamindavid "benjamindavid (1 commits)")

---

Tags

craft-commercecraft-plugincraftcmssagepayyii2omnipaycraftcmscommercesagepaysage pay

### Embed Badge

![Health badge](/badges/craftcms-commerce-sagepay/health.svg)

```
[![Health](https://phpackages.com/badges/craftcms-commerce-sagepay/health.svg)](https://phpackages.com/packages/craftcms-commerce-sagepay)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
