Skip to main content

Void Invoice

Void an invoice.

Example

Use the $API->action(); method to void invoice #13011.

<?php

/**
* Example of voiding an invoice
*/

header('Content-Type: text/plain');

require '../ChargeOverAPI.php';
require 'config.php';

$API = new ChargeOverAPI($url, $authmode, $username, $password);

// The invoice that we want to void
$invoice_id = 13011;

// Void an invoice
$resp = $API->action('invoice', $invoice_id, 'void');

if (!$API->isError($resp))
{
print('Voided the invoice!' . "\n");
}
else
{
print('Error voiding invoice via API' . "\n");

print('Error message was: ' . $resp->code . ': ' . $resp->message . "\n");

print("\n\n\n\n");
print($API->lastRequest());
print("\n\n\n\n");
print($API->lastResponse());
print("\n\n\n\n");
}