skip to content

API - Add New Payment

URL: GenerateNewPayment.php

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
ClientID
PaymentDate (YYYY-MM-DD format)
PaymentAmount (9999.99 format)

Optional Fields:

PaymentMethod (Cash,EFT,Debit Order, Credit Card, Debit Card, or any other string value. Defaults to Cash)
ReferenceNumber (String value, max 30 chars)
Description (String value)
SendThankYou (true or false - will include the description in the proof of payment email sent)
EmailToClient (true or false)

Returns:

JSON array containing:

$array[url] - the url where the document can be downloaded
$array[invoice_nr] - the payout number
$array[email_url] - url to open to have the document emailed to the client

Example PHP code with JSON

$param['username'] = '';
$param['password'] = '';
$param['ClientID'] = '';
$param['PaymentDate'] = '2015-01-25'; 
$param['PaymentAmount'] = '199.99';
	
$url = 'https://www.invoicesonline.co.za/api/GenerateNewPayment.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