How to upgrade Fontis Australia to the new Auspost API

Posted September 06th, 2016 in Computers
The Fontis Australia extension adds functionality to Magento stores running in Australia. This includes postage rates which are sourced from the Auspost API. Recently, Auspost changed the URL for their API which affects older versions of the extension. For those Magento installations which are running an older version of Fontis Australia, you will need to make changes to the extension in order to facilitate the new Auspost API (detailed at Although this may seem a daunting task, it is quite simple when using the documentation provided by Fontis located at

The obsolete Auspost API was located at, and the new one is at

To update the Fontis Australia Magento extension to use the new Auspost API, there are two files which need to be changed:
  1. app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Postage/PostageClient.php
  2. app/code/community/Fontis/Australia/lib/vendor/fontis/auspost-api-php/src/Auspost/Postage/service.json

Changes to PostageClient.php

In the PostageClient.php file, before the line:

Change #1:

public static function factory($config = array()){

add the following:

const API_URL = '';

This line sets the API URL in one location, making it easier to change in the future.

Change #2:

Locate any instances of the following:


and change them to:


This sets the API URL to the one that was specified in the first change.

Change #3:

Remove the following lines of code:

$baseUrl = array(

// Ignore unnecessary user-specified configuration values
if ($developerMode) {

The test URL is no longer used as it does not resolve.

Changes to service.json

In the service.json file, remove the 'api/' from the start of each uri. For example, the following line:

"uri": "api/postcode/search",


"uri": "postcode/search",

Once the above changes have been made, you may need to clear cache (Admin->System->Cache Management). To test if this worked, add an item to the shopping cart and verify that there are Australia Post shipping methods available, either through a postage estimate or on the checkout page.



No comments

Leave a comment