PHPackages                             itinerisltd/gf-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. [Payment Processing](/categories/payments)
4. /
5. itinerisltd/gf-sagepay

ActiveWordpress-plugin[Payment Processing](/categories/payments)

itinerisltd/gf-sagepay
======================

Gravity Forms Add-on for SagePay

0.12.1(6mo ago)42.5k[6 PRs](https://github.com/ItinerisLtd/gf-sagepay/pulls)MITPHPPHP ^8.1CI passing

Since Apr 16Pushed 1mo ago10 watchersCompare

[ Source](https://github.com/ItinerisLtd/gf-sagepay)[ Packagist](https://packagist.org/packages/itinerisltd/gf-sagepay)[ Docs](https://github.com/ItinerisLtd/gf-sagepay)[ RSS](/packages/itinerisltd-gf-sagepay/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (4)Versions (41)Used By (0)

GF SagePay
==========

[](#gf-sagepay)

[![GitHub Actions](https://github.com/ItinerisLtd/gf-sagepay/actions/workflows/test.yml/badge.svg)](https://github.com/ItinerisLtd/gf-sagepay)[![Packagist Version](https://camo.githubusercontent.com/aece59469ca7977353e9f065cdc4a77c61be0a3f37b185ee543667453a4cdc9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6974696e657269736c74642f67662d736167657061792e7376673f6c6162656c3d72656c65617365267374796c653d666c61742d737175617265)](https://packagist.org/packages/itinerisltd/gf-sagepay)[![PHP from Packagist](https://camo.githubusercontent.com/0139cfd44f24ecd5439c798c6660062d0368b85b402a213ac3d4673e8158bee7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6974696e657269736c74642f67662d736167657061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/itinerisltd/gf-sagepay)[![Packagist Downloads](https://camo.githubusercontent.com/1a740ba809012110bb72d8e8aec7b5bd2e4dae03643136424a9d8d9412802ad0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6974696e657269736c74642f67662d736167657061792e7376673f6c6162656c3d7061636b6167697374253230646f776e6c6f616473267374796c653d666c61742d737175617265)](https://packagist.org/packages/itinerisltd/gf-sagepay/stats)[![GitHub License](https://camo.githubusercontent.com/86611a39d8355cccac8a8c9f214c416d604d3c26abe2fb9264633761f47c0a08/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6974696e657269736c74642f67662d736167657061792e7376673f7374796c653d666c61742d737175617265)](https://github.com/ItinerisLtd/gf-sagepay/blob/master/LICENSE)[![Hire Itineris](https://camo.githubusercontent.com/797dba83c3eb23364eccb600c08a5859e28f7cdbeb4d2b3e3c040067943ad07a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f486972652d4974696e657269732d6666363962342e7376673f7374796c653d666c61742d737175617265)](https://www.itineris.co.uk/contact/)[![Twitter Follow @itineris_ltd](https://camo.githubusercontent.com/c6808dadb94ed1d01a91cc31ef6a97d9862b9bd5240ca81f801250ea0bd2ad8f/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f6974696e657269735f6c74643f7374796c653d666c61742d73717561726526636f6c6f723d316461316632)](https://twitter.com/itineris_ltd)[![Twitter Follow @TangRufus](https://camo.githubusercontent.com/64c804143721582680296b23033be0dc5a144ef604eb7bf94c94f619a83bb71f/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f54616e6752756675733f7374796c653d666c61742d73717561726526636f6c6f723d316461316632)](https://twitter.com/tangrufus)

SagePay payment gateway for GravityForms.

- [Goal](#goal)
- [Features](#features)
- [Not Supported / Not Implemented](#not-supported--not-implemented)
- [Minimum Requirements](#minimum-requirements)
- [Installation](#installation)
    - [Composer (Recommended)](#composer-recommended)
    - [Build from Source (Not Recommended)](#build-from-source-not-recommended)
- [Best Practices](#best-practices)
    - [HTTPS Everywhere](#https-everywhere)
    - [Payment Status](#payment-status)
    - [Fraud Protection](#fraud-protection)
- [Test Sandbox](#test-sandbox)
- [Common Issues](#common-issues)
    - [Missing Gift Aid Acceptance Box](#missing-gift-aid-acceptance-box)
    - [GF SagePay is Missing on Form Settings](#gf-sagepay-is-missing-on-form-settings)
- [Shipping Address](#shipping-address)
    - [Use case: Not delivering any physical goods](#use-case-not-delivering-any-physical-goods)
    - [Use case: Allow ship to billing address](#use-case-allow-ship-to-billing-address)
- [FAQ](#faq)
    - [Will you add support for older PHP versions?](#will-you-add-support-for-older-php-versions)
    - [It looks awesome. Where can I find more goodies like this?](#it-looks-awesome-where-can-i-find-more-goodies-like-this)
    - [Where can I give ⭐⭐⭐⭐⭐ reviews?](#where-can-i-give-starstarstarstarstar-reviews)
- [Developing](#developing)
    - [Public API](#public-api)
        - [Build URL for continuing confirmation](#build-url-for-continuing-confirmation)
        - [Redirect URL Retrieval Failure Handling](#redirect-url-retrieval-failure-handling)
    - [Required Reading List](#required-reading-list)
    - [Gravity Forms](#gravity-forms)
    - [Testing](#testing)
- [Feedback](#feedback)
- [Change Log](#change-log)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

Goal
----

[](#goal)

Allow Gravity Forms accepts SagePay one-off payments via [SagePay Server](https://www.sagepay.co.uk/support/15/36/sage-pay-server-understanding-the-process).

Features
--------

[](#features)

- [SagePay Server](https://www.sagepay.co.uk/support/15/36/sage-pay-server-understanding-the-process)
- [Gift Aid](https://www.sagepay.co.uk/support/12/36/gift-aid)
- [3D Secure](https://www.sagepay.co.uk/support/12/36/3d-secure-explained)
- [AVS/CV2](https://www.sagepay.co.uk/support/28/36/activating-adding-avs/cv2-rules)
- [Gravity Forms Logging](https://docs.gravityforms.com/logging-and-debugging/)
- [Gravity Forms Notification Events](https://docs.gravityforms.com/gravity-forms-notification-events/)
- [Gravity Forms Confirmation](https://docs.gravityforms.com/configuring-confirmations-in-gravity-forms/)
- [Gravity Forms Conditional Logic](https://docs.gravityforms.com/enable-conditional-logic/)

Not Supported / Not Implemented
-------------------------------

[](#not-supported--not-implemented)

Although these features are not supported by this plugin, but you might able to do so via [MySagePay](https://live.sagepay.com/mysagepay/login.msp):

- Card reference
- Token billing
- Deferred payment
- Recurring payment
- Void
- Refund
- Abort
- Basket
- Surcharges
- Account Type M – for telephone (MOTO) transactions
- Account Type C – for repeat transactions

[Pull requests](https://github.com/ItinerisLtd/gf-sagepay) are welcomed.

Minimum Requirements
--------------------

[](#minimum-requirements)

- PHP v7.2
- PHP cURL Extension
- WordPress v4.9.5
- [Gravity Forms](https://www.gravityforms.com/) v2.4.14.4

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

[](#installation)

### Composer (Recommended)

[](#composer-recommended)

```
composer require itinerisltd/gf-sagepay
```

### Build from Source (Not Recommended)

[](#build-from-source-not-recommended)

```
# Make sure you use the same PHP version as remote servers.
# Building inside docker images is recommanded.
php -v

# Checkout source code
git clone https://github.com/ItinerisLtd/gf-sagepay.git
cd gf-sagepay
git checkout

# Build the zip file
composer release:build
```

Then, install `release/gf-sagepay.zip` [as usual](https://codex.wordpress.org/Managing_Plugins#Installing_Plugins).

Best Practices
--------------

[](#best-practices)

### HTTPS Everywhere

[](#https-everywhere)

Although SagePay accepts insecure HTTP sites, you should **always use HTTPS** to protect all communication.

### Payment Status

[](#payment-status)

Always double check payment status on [MySagePay](https://live.sagepay.com/mysagepay/login.msp).

### Fraud Protection

[](#fraud-protection)

To prevent chargebacks, enforce [3D Secure](https://www.sagepay.co.uk/support/12/36/3d-secure-explained) and [AVS/CV2](https://www.sagepay.co.uk/support/28/36/activating-adding-avs/cv2-rules) rules whenever possible.

Test Sandbox
------------

[](#test-sandbox)

Always test the plugin and your fraud protection rules in test sandbox before going live.

If you can't whitelist test server IPs, use `protxross` as `Vendor Code`.

Use [ngrok](https://ngrok.com/) to make local notification URLs publicly accessible.

Use one of the [test credit cards](https://www.sagepay.co.uk/support/12/36/test-card-details-for-your-test-transactions).

Common Issues
-------------

[](#common-issues)

### Missing Gift Aid Acceptance Box

[](#missing-gift-aid-acceptance-box)

Only registered charities can use [Gift Aid](https://www.sagepay.co.uk/support/12/36/gift-aid) through the Sage Pay platform. The gift aid acceptance box only appears if your vendor account is Gift Aid enabled and using **Donation** as transaction type.

### GF SagePay is Missing on Form Settings

[](#gf-sagepay-is-missing-on-form-settings)

Make sure you meet the [minimum requirements](#minimum-requirements). Check your environment details at the [System Status Page](https://docs.gravityforms.com/checking-environment-details/).

Shipping Address
----------------

[](#shipping-address)

[OmniPay](https://omnipay.thephpleague.com/) requires both billing address and shipping address.

### Use case: Not delivering any physical goods

[](#use-case-not-delivering-any-physical-goods)

Map the shipping address fields to the billing ones.

### Use case: Allow ship to billing address

[](#use-case-allow-ship-to-billing-address)

This is similar to the the WooCommerce way.

Use Gravity Forms' built-in feature: [Display option to use the values submitted in different field](https://docs.gravityforms.com/address-field/#advanced-settings)

FAQ
---

[](#faq)

### Will you add support for older PHP versions?

[](#will-you-add-support-for-older-php-versions)

Never! This plugin will only work on [actively supported PHP versions](https://secure.php.net/supported-versions.php).

Don't use it on **end of life** or **security fixes only** PHP versions.

### It looks awesome. Where can I find more goodies like this?

[](#it-looks-awesome-where-can-i-find-more-goodies-like-this)

- Articles on [Itineris' blog](https://www.itineris.co.uk/blog/)
- More projects on [Itineris' GitHub profile](https://github.com/itinerisltd)
- More plugins on [Itineris](https://profiles.wordpress.org/itinerisltd/#content-plugins) and [TangRufus](https://profiles.wordpress.org/tangrufus/#content-plugins) wp.org profiles
- Follow [@itineris\_ltd](https://twitter.com/itineris_ltd) and [@TangRufus](https://twitter.com/tangrufus) on Twitter
- Hire [Itineris](https://www.itineris.co.uk/services/) to build your next awesome site

### Where can I give ⭐⭐⭐⭐⭐ reviews?

[](#where-can-i-give-starstarstarstarstar-reviews)

Thanks! Glad you like it. It's important to let my boss knows somebody is using this project. Please consider:

- leave a 5-star review on [wordpress.org](https://wordpress.org/support/plugin/gf-sagepay/reviews/)
- tweet something good with mentioning [@itineris\_ltd](https://twitter.com/itineris_ltd) and [@TangRufus](https://twitter.com/tangrufus)
- ⭐ star this [Github repo](https://github.com/ItinerisLtd/gf-sagepay)
- 👀 watch this [Github repo](https://github.com/ItinerisLtd/gf-sagepay)
- write blog posts
- submit [pull requests](https://github.com/ItinerisLtd/gf-sagepay)
- [hire Itineris](https://www.itineris.co.uk/services/)

Developing
----------

[](#developing)

### Public API

[](#public-api)

#### Build URL for continuing confirmation

[](#build-url-for-continuing-confirmation)

`ConfirmationHandler::buildUrlFor(Entry $entry, int $ttlInSeconds = 3600): string`

Usage:

```
$entryId = 123;
$rawEntry = GFAPI::get_entry($entryId);
if (is_wp_error($rawEntry)) {
    wp_die('Entry not found');
}

$url = ConfirmationHandler::buildUrlFor(
    new Entry($rawEntry),
    86400 // expires in 24 hours (24*3600=86400)
);

echo $url;
// https://example.com?entry=123&gf-sagepay-token=XXXXXXXXXXXX
```

Use Case: With ["using confirmation query strings to populate a form based on another submission"](https://docs.gravityforms.com/using-confirmation-query-strings-to-populate-a-form-based-on-another-submission/):

1. User fills in formA
2. User completes SagePay checkout form
3. User comes back and hits `CallbackHandler`
4. `CallbackHandler` sends user to formB according to confirmation settings
5. User arrives formB url with merged query strings

If the user quits before completing formB, you could use `ConfirmationHandler::buildUrlFor` generate a single-use, short-lived url for the user to resume formB.

Note:

- The url continues Gravity Forms confirmation
- Whoever got the url will go on confirmation, no authentication performed
- The confirmation will use latest field values from database which could have changed
- No payment status checking

#### Redirect URL Retrieval Failure Handling

[](#redirect-url-retrieval-failure-handling)

After form submit, this plugin sends order information to SagePay in exchange for a redirect URL(the SagePay hosted checkout form URL).

By default, when redirect URL retrieval fails:

1. Mark entry payment status as `Failed`
2. [Log](https://docs.gravityforms.com/logging-and-debugging/) the error
3. `wp_die` **immediately**

Common failure reasons:

- Incorrect vendor code
- Server IP not whitelisted

Tips: Check the [log](https://docs.gravityforms.com/logging-and-debugging/).

You can use `'gf_sagepay_redirect_url_failure_wp_die'` filter to:

- continue Gravity Forms' feed and confirmation flow
- perform extra operations
- redirect to a different error page

**Important:** If this filter returns `false`, normal Gravity Forms' feed and confirmation flow continues. Improper settings might lead to disasters.

Example:

```
add_filter('gf_sagepay_redirect_url_failure_wp_die', function(bool $shouldWpDie, ServerAuthorizeResponse $response, Entry $entry, GFPaymentAddOn $addOn): bool {

    // Do something.

    return true; // Do `wp_die`
    return false; // Don't `wp_die`, continue normal flow
    return $shouldWpDie; // Undecisive
}, 10, 4);
```

### Required Reading List

[](#required-reading-list)

Read the followings before developing:

- [SagePay Server: Understanding the process](https://www.sagepay.co.uk/support/15/36/sage-pay-server-understanding-the-process)
- [SagePay Server integration kits, protocols and documents](https://www.sagepay.co.uk/support/find-an-integration-document/server-integration-documents)
- [Gravity Forms: GFPaymentAddOn](https://docs.gravityforms.com/gfpaymentaddon/)
- [Gravity Forms: Entry Object](https://docs.gravityforms.com/entry-object/)
- [Omnipay: Sage Pay](https://github.com/thephpleague/omnipay-sagepay)
- [thephpleague/omnipay-sagepay#45 (comment)](https://github.com/thephpleague/omnipay-sagepay/pull/45#issuecomment-150667423)
- [thephpleague/omnipay-sagepay#255 (comment)](https://github.com/thephpleague/omnipay/issues/255#issuecomment-90509446)

### Gravity Forms

[](#gravity-forms)

Gravity Forms has undocumented hidden magics, read its source code.

### Testing

[](#testing)

```
composer style:check
```

Pull requests without tests will not be accepted!

Feedback
--------

[](#feedback)

**Please provide feedback!** We want to make this library useful in as many projects as possible. Please submit an [issue](https://github.com/ItinerisLtd/gf-sagepay/issues/new) and point out what you do and don't like, or fork the project and make suggestions. **No issue is too small.**

Change Log
----------

[](#change-log)

Please see [CHANGELOG](./CHANGELOG.md) for more information on what has changed recently.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

[GF SagePay](https://github.com/ItinerisLtd/gf-sagepay) is a [Itineris Limited](https://www.itineris.co.uk/) project created by [Tang Rufus](https://typist.tech).

Full list of contributors can be found [here](https://github.com/ItinerisLtd/gf-sagepay/graphs/contributors).

License
-------

[](#license)

[GF SagePay](https://github.com/ItinerisLtd/gf-sagepay) is released under the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 56.8% 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 ~83 days

Recently: every ~523 days

Total

34

Last Release

191d ago

PHP version history (3 changes)0.1.0PHP ^7.2

0.5.0PHP ^7.1

0.11.0PHP ^8.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/1f6b0052977c5b438b9677de0189a69e4c2aa7c945eedd76fa3adac30dab067c?d=identicon)[codepuncher](/maintainers/codepuncher)

---

Top Contributors

[![tangrufus](https://avatars.githubusercontent.com/u/2259834?v=4)](https://github.com/tangrufus "tangrufus (225 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (144 commits)")[![codepuncher](https://avatars.githubusercontent.com/u/8135396?v=4)](https://github.com/codepuncher "codepuncher (21 commits)")[![danlapteacru](https://avatars.githubusercontent.com/u/6186169?v=4)](https://github.com/danlapteacru "danlapteacru (4 commits)")[![itineris-milos](https://avatars.githubusercontent.com/u/29227000?v=4)](https://github.com/itineris-milos "itineris-milos (2 commits)")

---

Tags

gravityformsgravityforms-paymentsagepaywordpresswordpress-pluginwordpresspaymentwpsagepaygravityformsgravity-forms

### Embed Badge

![Health badge](/badges/itinerisltd-gf-sagepay/health.svg)

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

###  Alternatives

[wp-pay-extensions/gravityforms

Gravity Forms driver for the WordPress payment processing library.

1133.3k2](/packages/wp-pay-extensions-gravityforms)[aimeos/ai-payments

Payment extension for Aimeos e-commerce solutions

2160.7k](/packages/aimeos-ai-payments)[wp-pay/core

Core components for the WordPress payment processing library.

29119.8k97](/packages/wp-pay-core)[academe/sagepay

A library to handle the back-end processing for the SagePay Server (protocol v3) service

1112.2k](/packages/academe-sagepay)

PHPackages © 2026

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