Fiona from Better Food – my business story
December 13, 2018
How to become a Bristol City Council supplier – notes from November’s Breakfast Forum
December 18, 2018

Web-based payments using Bristol Pounds

In this short blog post, we would like to show you how easy it is to enable web-based payments using Bristol Pounds.

Everyone knows that more and more trade is being done online and 2018 has (unsurprisingly) seen record online spending. The Office for National Statistics recently reported that 18.4% of retail sales are now made online.

Until now Bristol Pound has been left behind on this trend as online shops have required payment in sterling, thankfully this is no longer the case!

We’ve put this blog post together to provide a guide to incorporating Bristol Pound payments into your website. Once completed, Bristol Pound users can make online payments from their Bristol Pound account to a Bristol Pound business account. This format will work for anyone wanting to take £B payments online.

The example used in this blog is The Real Economy. The Real Economy is an online shop allowing people to buy products from a variety of local producers. They want to inspire people to cook and eat the very best food and become part of a movement to transform the food system, you can read more here.

Chris from Real Economy had this to say about online £B payments:

Here at Real Economy we realised early on that being able to make online sales using Bristol Pounds was going to be important in our aim to create a market for local farmers.

Using Bristol Pounds is a way of emphasising our values and is part of what makes us distinctive as a food supplier.”

Huge thanks go to Tim at Spiral Edge for his work on this blog!


How it works:

When users put together an order thorough real Economy, they add things to their basket as shown below. Then once per week, orders are aggregated and delivered directly to customers via a network of pickup points.


Screen 1:

Screen 2:

Screen 3:

As you can see from the screens above, the order can be fulfilled using Bristol Pounds, as chosen from the drop-down list of payment options.

Once the Bristol Pound username and password has been entered, the payment is made in Bristol Pounds and behind the scenes, the money moves from one account to another.


In order to do this on your website, you will need the following information:

  • Your Bristol Pound account / username
  • Access credentials to your website
  • FTP access credentials for the website server

If you are unsure of your BP username, please email or call 0117 929 8642

For all other details, please ask your internal technical folk or website supplier.

Our Recipe – just add web-based payments!

1. Install the Cyclos PHP library via composer (“bristolpound/cyclos-php-library”) or by manually downloading the file from

2. Ask Bristol Pound to provide you with authentication credentials for online payments via Cyclos. Please email or call 0117 929 8642

3. Ensure the Cyclos PHP library is loaded by calling: require ‘vendor/autoload.php’;

4. The payment flow is as follows:

a) When a payment needs to be made, create a Bristol Pound payment ticket with your reference attached to it.
b) Redirect the user to Bristol Pound ticket payment page with a URL that is specific to that ticket.
c) Once the user returns to your website, check the status of the ticket, if it is paid then complete the order process.

Code to create a ticket

The following PHP code shows how to create a ticket. Note – the upper case static references will need to be defined for this to work properly.


        Cyclos\Configuration::setAuthentication(REAL_ECONOMY_BP_USER, REAL_ECONOMY_BP_PASS);

        $ticketService = new Cyclos\TicketService();

        $query = new stdclass();

        $query->amount = $amount;

        $query->description = "Real Economy Order";

        $query->cancelUrl = <CANCEL_URL>;

        $query->successUrl = <SUCCESS_URL>);

        $query->type = $query_type;

        $result->ticket = $ticketService->create($query);

Code to redirect a user

The following code shows you how to redirect a user to the correct location:

header('Location: ' . BP_SERVICE_URL  . '/pay/' . $result->ticket->ticketNumber);

(note - the BP_SERVICE_URL is provided by Bristol Pound)

Code to check a ticket

Here is the code to check a ticket.


Cyclos\Configuration::setAuthentication(REAL_ECONOMY_BP_USER, REAL_ECONOMY_BP_PASS);

$ticketService = new Cyclos\TicketService();

$ticket = $ticketService->getData($ticketNumber);

if ($ticket && $ticket->transaction->status == "PROCESSED") {

    // the ticket is paid!



There is no paypal-style payment notifier to call a page on your website once the payment has been made so you will need to figure out how to handle the case of a user not returning to our website. For Real Economy, we used something like this:

  • Create ticket
  • Redirect user to BP to pay the ticket.
  • If user returns to the success URL, check the ticket status and complete the order.
  • We run a cron job every 5 minutes that checks for incomplete orders with tickets attached. It checks the status of these tickets and if any are paid it completes the order.


If you have any questions or need anything clarifying, please get in touch by emailing!


Comments are closed.