How To: Installing Webpay St George IPG on a cPanel server

319th Oct 2011IT, Server Stuff, , ,

I’m often asked about this being connected to quite a number of ecommerce developers mainly developing ecommerce solutions with Magento…. So I thought I’d share a rough step by step. I did an install yesterday and the below got it all working… I’m assuming you’re using Linux / cPanel but it should all work on a straight Linux install, although some of the paths will change, particularly the php extension path.

– Get the doco from St George, it’ll help you understand how the Webpay API works.
– Download the Linux dev kit package from St George, Or click here and save to your PC. (wget won’t work because they need a useragent, it’s like 150kb so i had no issues with this but you could possibly use wget -U flag)
– Prepare your server, ensuring it’s got all the required bits and bobs!

Prepare the server with all the bits we need, most should already be installed if not all!

yum install swig
yum install gcc gcc-c++ autoconf automake
yum install sed

yum is great and makes this all fairly easy at this stage. You’ll also need PERL and I think php-devel but they’re there already in most cases.

– Upload your SDK to say the /root directory then decompress the taball

tar -xzvf StGeorgeLinuxAPI-3.3.tar.gz
cd webpaySWIG-3.3

That should expand to webpaySWIG-3.33 and that’s where all the goodies are.

Edit the config within the makefilePhp5 file as follows:

nano makefilePhp5

Now edit the values as below but NOTE: your directory location can be different from what I’ve used, using phpinfo() should reveal the correct extension directory.

PHP_EXTENSIONS  = /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ РLine 33
PHP_INCLUDE_DIR = /usr/include/php/ – Line 37

LIB_LOCATION¬† should be the same at PHP_EXTENSIONS and the makefile is scoped this way, if it’s not then change it.

Once done save the file. We’re ready to compile the libraries and complete the first stage. Run the below command:

make -f makefilePhp5

This will build the API for php on your server. But we’re not done yet!!!

Time to test and see how we go, the dev kit is packaged with some test scripts, the simplest is the located in php5 a file called test.php you may need to edit this file more than just some config variables but you can avoid this by enabling the dl() function (on cPanel go to ‘PHP Configuration Editor’ and check yes to enable_dl) Now to test we’ll use the certificate file the St George bank sent you… Upload it to the following directory on your server /root/webpaySWIG-3.3/

Now we can edit the test.php file and use some real settings use nano or vi to edit php5/test.php

There are a range of options at the top of this script, all definitions so just edit them, they’re self explanatory but you should use port 3007 for testing and for the server.

You could potentially run the require tests that St George stipulate with this script, you’ll just need to edit the transaction data part below the main config.

Once done save… we can now run a test from the command line:

php-cli php5/test.php OR php php5/test.php

The output will be displayed and if you get a transaction result and no errors you’ve done it.

Depending on how you’re going to use the IPG you might find it easy to add the library to your servers php.ini file.

Add this:

In some instances I’ve seen all sorts of random errors that really made no sense when I attempted to diagnose them but I’ve found for a number of issues you it’s because the SSL libraries could not be loaded so we need to create a symlink to them just run the below commands:

ln -s /usr/lib/ /lib/
ln -s /usr/lib/ /lib/

Now I think you’ll be all done… If you’re using Magento or similar it does not stop there you’ve only installed the API now you need to implement something to interface with it. In my experience Magento users grab this Mage extension from fontis it which in my experience is solid and stable.

Edit: Mage = Magento (Shorter and easier to say)

I’ve had quite a number of emails from many people who’ve used this to their benefit and I understand that some of the details may change from time to time. Email me or contact me if you’re having issues and I’ll see what I can do!

Published Oct 19 2011

  1. james (May 17, 2012, 12:44 pm). Reply

    Great stuff, thanks for the step by step. helped me out thankfully!

  2. Lindsey (January 3, 2014, 2:20 pm). Reply

    HI Brad,

    thanks for the step by step – I have opted for the Hosted Payment Page rather than the API version – can you shed any light on how I would set that up?

  3. Anna (June 18, 2014, 3:07 pm). Reply

    Im super stuck with this. I keep getting “Unable to communicate with the WTS” any help would be greatly appreciated!

Add a Comment