PDF Invoice Archiving

PDF Invoice Archiving

Back   Posted on 18 april 2020 / Updated on 17 september 2020
Reading time 3 minutes

Archiving Invoice PDF of WHMCS

When it comes to PDF files, WHMCS isn't flexible but thanks to Billing Extension you can archive invoice PDF on FTP.

This is particularly useful if your company uses a DMS (Document Management System) to process invoices as PDF files. This way not only you can to extract data from files but also store them in a logical folder structure. For example you could group invoices by currency, payment method and so on.

As if it wasn't enough, you can also schedule the sending of PDF files to multiuple recipients (eg. your accountant) on a weekly or monthly basis.

Sending PDF Batch Export manually via email will be a thing from the past. All files are attached in the email and compressed in a zip archive. Similarly to FTP archiving, you can define a logical folder structure within the zip.

Before we start exploring the full potential of this feature, let us underline that unlike WHMCS, Billing Extension is capable of handling any type of document (proforma, invoice and credit note). If you need more room for customization, you can take a look at the integrated web service that allows to pull data from WHMCS and ease your accounting workflow.

Custom PDF and Path Format

Not only you can freely specify the invoice numering format you wish to use, but also the full path. Below there's a list of the available auto tags that work for both FTP and email transmission. Keep in mind you can have a dedicated configuration for each of them.

  • {YEAR} Format yyyy (2020, 2021...)
  • {MONTH} Format mm (10, 11...)
  • {DAY} Format gg (09, 10...)
  • {NUMBER} Invoice number (tblinvoices.invoicenum)
  • {ID} Invoice ID (tblinvoices.id)
  • {TYPE} Document type (Proforma, Invoice, CreditNote)
  • {USERID} User ID
  • {COUNTRY} User country ISO 3166-1 alpha-2 (IT, US, DE...)
  • {CURRENCY} User currency (EUR, USD, AUD...)
  • {PAYMENTMETHOD} Payment gateway system name (paypal, stripe...)

We borrowed the concept of auto-insert tags to let you design your folder structure and file names quickly. An auto-tag like {COUNTRY} acts as a placeholder that in this case is replaced by customer's country. There are a few more things to consider:

  • You can pick any tag and use them in any order
  • The same tag can be used multiple times
  • Use slash / as directory separator and .pdf as file extension
  • You can insert any character but / \ : * ? " < > | are replaced with -

Below we're going to show you some examples but there are no limits to customization. We clear once again that you can define different logical folder structure for FTP transmission and the zip archive attached in the email.


  • 2020/04/USD/US-Invoice 120.pdf
  • 2020/04/USD/US-Invoice 121.pdf
  • 2020/04/EUR/IT-Invoice 122.pdf
  • 2020/04/EUR/FR-Invoice 123.pdf


  • 2020/04/Invoice/USD-US-Invoice 120.pdf
  • 2020/04/Invoice/USD-US-Invoice 121.pdf
  • 2020/04/CreditNote/EUR-IT-Credit Note 122.pdf
  • 2020/04/Proforma/EUR-FR-Proforma 8204.pdf


  • Invoice/banktransfer/Invoice-120.pdf
  • Invoice/banktransfer/Invoice-121.pdf
  • Proforma/stripe/Proforma-8912.pdf
  • Proforma/paypal/Proforma-8924.pdf

Automation Logic

Billing Extension lets you define a "starting date" so that you can avoid transmitting very old PDF files. File transmission via FTP and email occur when WHMCS daily cron job completes and is based on documet date (tblinvoices.date). Typically this value corresponds to:

  • Generation date for proforma
  • Issuing date for invoices and credit notes

Whenever the module completes a transmission it stores "last run" date so that it always knows where to resume the processing in case daily cron job didn't run for some reason.

It is worth to remind you that:

  • If something goes wrong the module creates an entry in both warning system and Activiy Log
  • You can force the module to retransmit files by changing start date
  • It is important to understand that when proforma invoicing is in use, the same document could be archived twice. The first when the proforma is generated and the second when it turns into an invoice
  • Files with the same name and path get overwritten

As for email sending, you can schedule the transmission on a weely or monthly basis. Weekly report is sent every Monday while monthly one on the first of every month.

Comments (0)

Speak Your Mind Cancel Reply