$row['payment_date'], 'method' => (string) $row['payment_method'], 'reference' => (string) $row['payment_reference'], ]); if (!$receipt_to) { http_response_code(400); $return_arr['success'] = "False"; $return_arr['message'] = $row['client_name'] . ' has no primary or billing contact with an email address to send the receipt to.'; echo json_encode($return_arr); exit(); } $update_count = 1; $return_arr['receipt_to'] = array_values($receipt_to); logAudit("Invoice", "Payment", "Payment receipt for invoice " . escapeSql($reference_text) . " queued to " . escapeSql(implode(', ', $receipt_to)) . " via API ($api_key_name)", $client_id, intval($row['invoice_id'])); logAudit("API", "Success", "Sent a payment receipt for invoice " . escapeSql($reference_text) . " via API ($api_key_name)", $client_id); } // Output require_once '../update_output.php';