Download the PHP package mitchdav/st-george-ipg without Composer

On this page you can find all versions of the php package mitchdav/st-george-ipg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package st-george-ipg

St.George IPG Client

Build Status Latest Stable Version Total Downloads License Coverage Status

A PHP client implementation of the St.George Internet Payment Gateway using the WebService or Webpay extension.

Using this library, you can provide your St.George-issued credentials and begin charging cards instantly.

The library supports all features of the gateway, including:

The library has 2 providers to connect to St.George:

WebService

The WebService is by far the easiest to integrate with, and just uses a simple HTTP client to connect to an API exposed by St.George.

Requirements

If you run into SSL connection issues using the WebService provider on OS X, please check this support thread.

Installation

You can install the library in your project with Composer:

composer require mitchdav/st-george-ipg

Initialising The Client

The WebService requires 2 credentials, which are your St.George-issued client ID, and an authentication token.

Copy your client ID into the environment variable, or modify the code below.

You can find the authentication token by logging into the Merchant Administraction Console, clicking on Merchant Details and then under IPG Accounts on the right, click your client ID and then go to the authentication tab.

In the list on the left, click on configure next to Security Token, and generate a token. Copy that value into the environment variable, or modify the code below.

You can then initialise the client with the following:

Extension

The extension is significantly harder to integrate with, and requires you to compile and install a PHP extension.

Requirements

Installation

You can install the library in your project with Composer:

composer require mitchdav/st-george-ipg

You'll then need to compile and install the Webpay PHP extension, which is explained below.

Initialising The Client

The Extension requires 2 credentials, which are your St.George-issued client ID, your certificate password, and optionally an authentication token.

Copy your client ID into the environment variable, or modify the code below.

Copy your certificate password into the environment variable, or modify the code below.

If you have previously set an authentication token, you can find it by logging into the Merchant Administraction Console, clicking on Merchant Details and then under IPG Accounts on the right, click your client ID and then go to the authentication tab.

In the list on the left, click on configure next to Security Token, and generate a token. Copy that value into the environment variable, or modify the code below.

If you have never set an authentication token, this step is optional and the transactions will complete successfully without it. If you have one set (perhaps if you were testing the WebService provider), you must set it on the Extension.

If your certificate is installed to a separate location, you can set the path into the environment variable, or modify the code below.

You can then initialise the client with the following:

Usage

The client provides helper methods to construct a valid request. More options are available for each request type than shown below, so check the Client to see how to optionally set the CVC2 (for example), or the merchant description.

After a request has been created, you need to call on the request to obtain the response. If the transaction is unsuccessful, the response code is mapped to different exceptions as shown below. If no exception is thrown, then the transaction was successful.

Charging the Customer (Purchase)

With an initialised client you can charge the customer, like so:

Refunding a Charge

You can refund the customer after charging them, like so:

Pre-Authorisation

You can also pre-authorise a charge (if enabled for your account), effectively putting a hold on a customer's card, like so:

Completion

After a successful pre-authorisation, you can complete the transaction, like so:

Handling Errors

The library will throw an exception if the request was not successful, which makes it easy to determine the outcome of a transaction.

Common error codes, such as when the customer has insufficient funds, or has used an invalid card number, have been mapped to special exceptions for you to use at your leisure. These special exceptions are instances of , which lets you call to retrieve the response. By catching this you can catch all errors where a response was obtained.

For errors where a response wasn't obtained, such as when a transaction fails, or remains in progress after 3 status checks, other exceptions are called, so check the Client class for more details (in the method). You can catch these using the generic class.

If there is a local error, indicated by a response code of , the exception will map to an instance of , with specific exceptions in the local errors folder. These exceptions typically indicate a connection issue, or a problem with the client ID or certificate password.

Testing

Now that you have a working installation, you can run the below testing commands:

The end-to-end testsuite connects to St.George's test server to run test transactions for all response codes from 00 - 99, so for this testsuite to run, you will need to have installed Webpay and setup your and (for the WebService) or (for the Extension) environment variables.

Installing Webpay

Note: As of July 2017 these instructions (both Docker and manual installation) were working correctly to connect to St.George. Unfortunately, when run after that period they will still compile and install correctly, but upon connecting to the St.George IPG server, it will give an SSL connection error which I haven't been able to resolve. If you find a solution please let me know.

Installing with Docker

The Webpay library is painful to install manually, so a Dockerfile has been provided for you which will get you mostly setup.

You can build it using the Dockerfile in this repository:

docker build -t mitchdav/st-george-ipg .

Once you have the built container, you can run it using the following:

docker run -e IPG_CLIENT_ID='10000000' -e IPG_CERTIFICATE_PASSWORD='password' -i -t mitchdav/st-george-ipg /bin/bash

Where you substitute in your own St.George-provided client ID and certificate password.

Installing Manually

If you are unable to use Docker, you can follow the below guideline of commands to run on a fresh AWS EC2 install of Ubuntu 16.04 (currently AMI ami-96666ff5). For all other installations, you will need to read the Linux API Developer Guide and resolve any issues for yourself.

sudo apt-get update -y
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update -y
sudo apt-get install -y swig gcc unzip php5.6 php5.6-cli php5.6-common php5.6-mbstring php5.6-gd php5.6-intl php5.6-xml php5.6-mysql php5.6-mcrypt php5.6-zip php5.6-dev composer
sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /lib/libcrypto.so.6
sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/libssl.so.6
wget https://www.ipg.stgeorge.com.au/downloads/StGeorgeLinuxAPI-3.3.tar.gz
tar -xzvf StGeorgeLinuxAPI-3.3.tar.gz
cd webpaySWIG-3.3/
sed -i 's\PHP_EXTENSIONS  = /usr/lib64/php/modules\PHP_EXTENSIONS  = /usr/lib/php/20131226\g' makefilePhp5
sed -i 's\PHP_INCLUDE_DIR = /usr/include/php/\PHP_INCLUDE_DIR = /usr/include/php/20131226/\g' makefilePhp5
sudo make -f makefilePhp5
sudo echo "extension=webpay_php.so" >> /etc/php/5.6/cli/php.ini
php -i | grep webpay

You will know that you've successfully installed the library if you see the output of the last command like so:

webpay
Client Type => webpayPHP5
Webpay PHP Library => webpay_php.so
Webpay Core Library => libwebpayclient.so

You will then need to download the certificate, using these commands in whichever directory you intend to run the project in:

wget https://www.ipg.stgeorge.com.au/downloads/cert.zip
unzip cert.zip

Note that this is done automatically for you when installing using Docker.

Finally, export your own St.George-provided client ID and certificate password like so:

export IPG_CLIENT_ID='10000000'
export IPG_CERTIFICATE_PASSWORD='password'

Some useful Stack Overflow questions to troubleshoot with are here:

Further Information

Further information about the St.George Internet Payment Gateway can be found here. The relevant files are:


All versions of st-george-ipg with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
inacho/php-credit-card-validator Version ^1.0
sabre/xml Version ^1.5
guzzlehttp/guzzle Version ^6.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mitchdav/st-george-ipg contains the following files

Loading the files please wait ....