Skip to content
PHP API Library for integration with Fat Zebra
PHP Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
example
test
.travis.yml
FatZebra.class.php
LICENSE.txt
README.markdown
Rakefile
ca-bundle-minimal.crt
ca-bundle.crt
composer.json

README.markdown

PHP API Library for Fat Zebra

Release 1.2.1 for API version 1.0

A PHP library for the Fat Zebra Online Payment Gateway (for Australian Merchants) Now supports recurring billing (subscriptions, plans, customers)

Dependencies

  • PHP (Tested on versions; 5.4, 5.6, 7.0, 7.1, 7.2)
  • cURL

Build Status

Installing

Copy the files FatZebra.class.php and ca-bundle.pem to your project lib folder (or similar)

Note: The ca-bundle.pem file needs to be placed in the same location as the FatZebra.class.php file to ensure certificate verification. The calls to the gateway will likely fail without this, however if you have taken steps to ensure this will work (such as including the bundle in your OS root trust store) you may use the set_ca_bundle method to define an empty string for the OS root trust store or the path to another bundle.

If you wish to use a minimal CA bundle you can copy the ca-bundle-minimal.pem file to the same directory, but rename it to ca-bundle.pem.

Usage

Regular Purchase

<?php
  session_start();
  include_once("../FatZebra.class.php");
  define("USERNAME", "havanaco");
  define("TOKEN", "673bb3aaca9a1961bfa3c61917594dc7c4a00b71");
  define("TEST_MODE", true);

  try {
  	$gateway = new FatZebra\Gateway(USERNAME, TOKEN, TEST_MODE);
  	$purchase_request = new FatZebra\PurchaseRequest($_POST['amount'], $_POST['reference'], $_POST['name'], $_POST['card_number'], $_POST['card_expiry_month'] ."/". $_POST['card_expiry_year'], $_POST['card_cvv'], null, 'AUD');

  	$response = $gateway->purchase($purchase_request);

  	$_SESSION['response'] = $response;
  	header("Location: index.php");
	} catch(Exception $ex) {
		print "Error: " . $ex->getMessage();
	}
?>

Token Purchase

<?php
  session_start();
  include_once("../FatZebra.class.php");
  define("USERNAME", "havanaco");
  define("TOKEN", "673bb3aaca9a1961bfa3c61917594dc7c4a00b71");
  define("TEST_MODE", true);

  $amount = 100;
  $reference = "your ref";

  try {
    $gateway = new FatZebra\Gateway(USERNAME, TOKEN, TEST_MODE);
    $response = $gateway->token_purchase($_POST['token'], $amount, $reference, null, 'AUD');

    $_SESSION['response'] = $response;
    header("Location: index.php");
  } catch(Exception $ex) {
    print "Error: " . $ex->getMessage();
  }
?>

See the example folder for this example tied into a website.

Documentation

Full API reference can be found at http://docs.fatzebra.com.au

Support

If you have any issue with the Fat Zebra PHP Client please contact us at support@fatzebra.com.au and we will be more then happy to help out. Alternatively you may raise an issue in github.

Pull Requests

If you would like to contribute to the plugin please fork the project, make your changes within a feature branch and then submit a pull request. All pull requests will be reviewed as soon as possible and integrated into the main branch if deemed suitable.

You can’t perform that action at this time.