skip to content

API - Client Statements

URL: ClientStatement.php

*Note that generated files are kept on the server for 2 days only.

JSON Option (recommended):

to use as JSON, append ?apiformat=json to the URL, then send through all variables as a JSON encoded string.

Required Fields:

username
password
type - Statement type, valid values are: date_range,full,historical (defaults to full)
format - Statement format, valid values are: csv,pdf (defaults to pdf)

Optional Fields

EmailToClient - boolean, defaults to false
TotalAmountOption - string, valid values are: ClientBalance (will show complete balance), OnlyShown (will show balance of shown items only)
from - required for date_range type. Must be a valid date in YYYY-MM-DD format.
to - required for date_range type. Must be a valid date in YYYY-MM-DD format.

Returns:

JSON encoded string
Possible Values:
type=>success,url=>Url from where file can be downloaded.
error=>Error message.

Example PHP code with JSON

$param['username'] = '';
$param['password'] = '';
$param['type'] = '';
$param['format'] = '';

$url = 'https://www.invoicesonline.co.za/api/ClientStatement.php?apiformat=json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); //set the url
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //return as a variable
curl_setopt($ch, CURLOPT_POST, 1); //set POST method
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($param)); //set the POST variables
$response = curl_exec($ch); //run the whole process and return the response

 

Updated: Sat, 30 May 2020