PHPackages                             twohill/silverstripe-pxpay - 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. twohill/silverstripe-pxpay

ActiveSilverstripe-vendormodule

twohill/silverstripe-pxpay
==========================

Payment Express controller

v1.0.4(5y ago)14761BSD-3-ClausePHP

Since Mar 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/twohill/silverstripe-pxpay)[ Packagist](https://packagist.org/packages/twohill/silverstripe-pxpay)[ Docs](https://github.com/twohill/silverstripe-pxpay)[ RSS](/packages/twohill-silverstripe-pxpay/feed)WikiDiscussions master Synced today

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

silverstripe-pxpay
==================

[](#silverstripe-pxpay)

A module that integrates your controller with Payment Express.

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

[](#requirements)

- SilverStripe ^4
- php-curl
- php-simplexml

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

[](#installation)

Using composer

```
composer require twohill/silverstripe-pxpay

```

License
-------

[](#license)

BSD 3-Clause "New" or "Revised" License. See [License](license.md)

Example configuration
---------------------

[](#example-configuration)

Configure your PxPayment details in a config yml file. You can specify different settings for `dev` or `live` modes. A useful option for doing this is to use your sandbox credentials when in `dev` mode.

```
---
Only:
  environment: 'live'
---
Twohill\PXPay\PxPaymentController:
  PxPayURL: https://sec.paymentexpress.com/pxaccess/pxpay.aspx
  PxPayUserId: MyUserID
  PxPayKey: xxxxxx

---
Only:
  environment: 'dev'
---
Twohill\PXPay\PxPaymentController:
  PxPayURL: https://sec.paymentexpress.com/pxaccess/pxpay.aspx
  PxPayUserId: MyUserID_dev
  PxPayKey: xxxxxx

```

Example usage
-------------

[](#example-usage)

Return the `PxPaymentController` as the result of a payment method

```
class MyPageController extends PageController
{
    private static $allowed_actions = [
        'thankyou',
        'pay_order',
        'unsuccessful',
    ];

    public function thankyou(HTTPRequest $request)
    {
        $content = '';
        if ($request->getSession()->get('OrderID')) {
            $order = Order::get()->byID($request->getSession()->get('OrderID'));

            if ($order) {

                $payment = $order->Payment();

                if ($payment && $payment->TxnId) {
                    if ($payment->Processed) {
                        $sendEmail = false;
                    } else {
                        $payment->Processed = true;
                        $payment->write();
                    }
                } else {
                    $this->redirect($this->Link('pay-order/submit'));
                }
                $content = $this->ThankYouForPayingContent; // From MyPage $db
            }

            $request->getSession()->clear("OrderID");
            return $this->customise(new ArrayData([
                'Content' => DBField::create_field('HTMLFragment', $content),
                'Form' => ''
            ]));
        }
        return $this->redirect($this->Link());
    }
    /**
     * Process the payment
     *
     * @param HTTPRequest $request
     * @return PxPaymentController
     * @throws ValidationException
     */
    public function pay_order(HTTPRequest $request)
    {

        // Load the payment details somehow
        $payment = null;

        if ($request->getSession()->get('OrderID')) {

            $order = Order::get()->byID($request->getSession()->get('OrderID'));

            if ($order) {
                $payment = new PxPayment();
                $payment->TxnType = "Purchase";
                $payment->MerchantReference = $order->InvoiceNumber;
                $payment->TxnData1 = $order->CompanyName;
                $payment->TxnData2 = $order->Address;
                $payment->TxnData3 = $order->City;
                $payment->EmailAddress = $order->Contact()->Email;
                $payment->AmountInput = $order->Total;
                $payment->CurrencyInput = "NZD";
                $payment->InvoiceID = $order->ID;
                $payment->write();
                }
            }
        }
        return new PxPaymentController($this, $request, $payment, $this->Link("thankyou"), $this->Link("unsuccessful"));
    }

    /**
     * Action when payment is unsuccessful.
     */
    public function unsuccessful(HTTPRequest $request)
    {
        if ($request->getSession()->get('OrderID')) {
            $order = Order::get()->byID($request->getSession()->get('OrderID'));
            if ($order) {
                return $this->customise([
                    'Content' => DBField::create_field('HTMLFragment', $this->UnsuccessfulContent),
                    'Form' => ''
                ]);
            }
        }
        return $this->redirect($this->Link());
    }

}
```

Maintainers
-----------

[](#maintainers)

- Al Twohill

Bugtracker
----------

[](#bugtracker)

Bugs are tracked in the issues section of this repository. Before submitting an issue please read over existing issues to ensure yours is unique.

If the issue does look like a new bug:

- Create a new issue
- Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots and screencasts can help here.
- Describe your environment as detailed as possible: SilverStripe version, Browser, PHP version, Operating System, any installed SilverStripe modules.

Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker.

Development and contribution
----------------------------

[](#development-and-contribution)

If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~146 days

Total

5

Last Release

2030d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98bde8ab82ea828d69bc57b056e07d2206c9ae8ba23f23d9a0ec609dc72d6fd2?d=identicon)[twohill](/maintainers/twohill)

---

Top Contributors

[![altwohill](https://avatars.githubusercontent.com/u/629254?v=4)](https://github.com/altwohill "altwohill (9 commits)")[![tomheadifen](https://avatars.githubusercontent.com/u/5233524?v=4)](https://github.com/tomheadifen "tomheadifen (1 commits)")

---

Tags

silverstripepaymentexpress

### Embed Badge

![Health badge](/badges/twohill-silverstripe-pxpay/health.svg)

```
[![Health](https://phpackages.com/badges/twohill-silverstripe-pxpay/health.svg)](https://phpackages.com/packages/twohill-silverstripe-pxpay)
```

###  Alternatives

[composer/installers

A multi-framework Composer library installer

1.4k136.0M6.0k](/packages/composer-installers)[colymba/gridfield-gallery-theme

SilverStripe 3 GridField component adding file or image thumbnail gallery view

157.1k1](/packages/colymba-gridfield-gallery-theme)[silverstripe/multi-domain

Allows multiple domains to access one CMS instance, mapping them to different sections of the hierarchy

141.6k](/packages/silverstripe-multi-domain)

PHPackages © 2026

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