PHPackages                             localgovdrupal/govuk\_pay - 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. [Payment Processing](/categories/payments)
4. /
5. localgovdrupal/govuk\_pay

ActiveDrupal-module[Payment Processing](/categories/payments)

localgovdrupal/govuk\_pay
=========================

Provides integration with GOV.UK Pay for Drupal.

1.x-dev(1y ago)025[4 issues](https://github.com/localgovdrupal/govuk_pay/issues)GPL-2.0-or-laterPHPCI passing

Since Apr 9Pushed 1y ago8 watchersCompare

[ Source](https://github.com/localgovdrupal/govuk_pay)[ Packagist](https://packagist.org/packages/localgovdrupal/govuk_pay)[ Docs](https://drupal.org/project/govuk_pay)[ RSS](/packages/localgovdrupal-govuk-pay/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelogDependencies (1)Versions (17)Used By (0)

GOV.UK Pay for Drupal
=====================

[](#govuk-pay-for-drupal)

Overview
--------

[](#overview)

This module provides integration with the GOV.UK Pay service for Drupal websites. GOV.UK Pay is the UK government's online payment service that allows users to make payments for government services.

Features
--------

[](#features)

- Secure API integration with GOV.UK Pay service
- Bearer token authentication with the GOV.UK Pay API
- Base configuration and service methods for other modules to utilize
- Extensible architecture allowing for additional payment functionality
- Webhook integration for automatic payment status updates

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

[](#requirements)

- Drupal 9.x or 10.x
- Access to a GOV.UK Pay account and API key

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

[](#installation)

1. Install the module using Composer: ```
    composer require drupal/govuk_pay

    ```
2. Enable the module through the Drupal admin interface or using Drush: ```
    drush en govuk_pay

    ```

Configuration
-------------

[](#configuration)

1. Navigate to the configuration page at Administration → Configuration → Web services → GOV.UK Pay
2. Enter your GOV.UK Pay API key
3. Configure the payment reference format that will appear on all completed payments
4. Save the configuration

API Authentication
------------------

[](#api-authentication)

The module handles authentication with the GOV.UK Pay API using the HTTP Bearer token format in the Authorization header. The API key is stored in Drupal's configuration system. You may want to override this key in your environment's `settings.local.php` file. To do so you would add the following lines:

```
// Override the GOV.UK Pay API key
$config['govuk_pay.settings']['gov_pay__apikey'] = 'your_api_key_here';

// Override the payment reference if needed
$config['govuk_pay.settings']['gov_pay__reference'] = 'Your Payment Reference';
```

Webhooks
--------

[](#webhooks)

The module provides a webhook endpoint that automatically updates payment entity statuses when they change in the GOV.UK Pay system. This ensures your Drupal site always has the most up-to-date payment information, even if users don't return to your site after completing a payment.

### Webhook Endpoint

[](#webhook-endpoint)

The webhook endpoint is available at:

```
/api/govuk-pay/webhook

```

### Setting Up Webhooks in GOV.UK Pay

[](#setting-up-webhooks-in-govuk-pay)

1. Log in to your GOV.UK Pay account
2. Navigate to the webhook settings section
3. Add a new webhook with your site's URL: `https://your-domain.com/api/govuk-pay/webhook`
4. Select which payment status events you want to receive notifications for (recommended: all status changes)

### How It Works

[](#how-it-works)

When a payment status changes in GOV.UK Pay:

1. GOV.UK Pay sends a notification to your webhook endpoint
2. The webhook controller validates the incoming data
3. The controller finds the corresponding payment entity in your Drupal site
4. The payment status is updated to match the current status in GOV.UK Pay
5. All actions are logged for auditing and debugging purposes

### Security Considerations

[](#security-considerations)

- The webhook endpoint is publicly accessible (as required for webhooks)
- Basic validation is performed on all incoming webhook data
- For additional security, consider implementing IP restrictions at the server level to only allow requests from GOV.UK Pay IP addresses

Extension
---------

[](#extension)

This module provides the base integration with GOV.UK Pay. Additional functionality is available through submodules:

- **GOV.UK Pay Webform**: Adds GOV.UK Pay integration to Drupal Webforms

Troubleshooting
---------------

[](#troubleshooting)

- Ensure your API key is valid and has the correct permissions
- Check the Drupal logs for any API communication errors
- Verify your server can make outbound HTTPS requests to the GOV.UK Pay API endpoints

Credits
-------

[](#credits)

Originally developed by [Webcurl](https://webcurl.co.uk/). Refactored and updated by [Royal Borough of Greenwich](https://www.royalgreenwich.gov.uk).

License
-------

[](#license)

This project is licensed under the GNU General Public License v2.0 or later.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance48

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 70.1% 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 ~0 days

Total

2

Last Release

390d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c215b54edbf914998f6f63747814fd96f117c2c6e1bb5ea0c0a0db24fd9b3901?d=identicon)[finnlewis](/maintainers/finnlewis)

---

Top Contributors

[![tanc](https://avatars.githubusercontent.com/u/76320?v=4)](https://github.com/tanc "tanc (54 commits)")[![graham-web](https://avatars.githubusercontent.com/u/47783560?v=4)](https://github.com/graham-web "graham-web (9 commits)")[![colinsherry](https://avatars.githubusercontent.com/u/25416668?v=4)](https://github.com/colinsherry "colinsherry (8 commits)")[![pankaj-naug](https://avatars.githubusercontent.com/u/183397750?v=4)](https://github.com/pankaj-naug "pankaj-naug (5 commits)")[![finnlewis](https://avatars.githubusercontent.com/u/326588?v=4)](https://github.com/finnlewis "finnlewis (1 commits)")

### Embed Badge

![Health badge](/badges/localgovdrupal-govuk-pay/health.svg)

```
[![Health](https://phpackages.com/badges/localgovdrupal-govuk-pay/health.svg)](https://phpackages.com/packages/localgovdrupal-govuk-pay)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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