recordRefund($refund, $apiContext); } catch (Exception $ex) { ResultPrinter::printError("Refund for Invoice", "Invoice", null, null, $ex); exit(1); } ResultPrinter::printResult("Refund for Invoice", "Invoice", $invoice->getId(), $refund, null); return $invoice;