setSubject("Past due") ->setNote("Canceling invoice") ->setSendToMerchant(true) ->setSendToPayer(true); // ### Cancel Invoice // Cancel invoice object by calling the // static `cancel` method // on the Invoice class by passing a valid // notification object // (See bootstrap.php for more on `ApiContext`) $cancelStatus = $invoice->cancel($notify, $apiContext); } catch (Exception $ex) { ResultPrinter::printError("Cancel Invoice", "Invoice", null, $notify, $ex); exit(1); } ResultPrinter::printResult("Cancel Invoice", "Invoice", $invoice->getId(), $notify, null);