According to this page, this is how you can download the invoice without need to login.
Create a php file, let's say, gen_invoice_pdf.php, and place it inside the root whmcs directory.
Add this code to the file:
<?php
include __DIR__ . '/init.php';
include __DIR__ . '/includes/invoicefunctions.php';
use WHMCS\Auth;
$user = filter_var($_GET['us'], FILTER_SANITIZE_STRING);
$pass = filter_var($_GET['pw'], FILTER_SANITIZE_STRING);
$id = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
$authAdmin = new Auth;
if ($authAdmin->getInfobyUsername($user) && $authAdmin->comparePassword($pass)) {
$isValid = true;
} else {
$isValid = false;
}
if (!$isValid) {
die('Access Denied');
}
if ($id > 0) {
$pdfdata = pdfInvoice($id);
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename=invoice_$id.pdf");
echo $pdfdata;
}
To download invoice id: 5, visit the url:
http://whmcs-example.com/gen_invoice_pdf.php?id=5&us=myuser&pw=mypass
Note: this will be accessible to any one knows the url, you can set the page accept connections from specific IP address, for example.
Update:
Added WHMCS admin authentication, works only for WHMCS >= 5.3.9, check: Admin Password Hashing.