Jump to content

Hook: Client Payment Terms (Immediate / Net 30 / Net 60) by Client Group


Manuel Y2K

Recommended Posts

Hi everyone,

I wanted to share a small WHMCS hook we created to support client-specific payment terms such as:

  • Immediate
  • Net 30
  • Net 60

Repo: https://github.com/Y2KWebs/whmcs-client-payment-terms

The problem

We needed a way to let some clients pay immediately, while others could have Net 30 or Net 60 terms.

As many of you probably know, WHMCS ties recurring billing pretty closely to the service renewal cycle. A common workaround is to generate invoices many days before the service due date, but that is not really the same as offering payment terms. It is just invoicing earlier.

What we actually wanted was:

  • keep the normal WHMCS service renewal logic
  • let WHMCS generate the invoice normally
  • change only the invoice due date
  • make sure the invoice email already goes out with the correct due date
  • keep compatibility with accounting syncs such as QuickBooks

Our approach

We used:

  • Client Groups to represent payment terms
  • the InvoiceCreation hook to adjust the invoice duedate before the invoice email is sent

The logic is simple:

  • clients with no group or no mapped group keep the standard WHMCS due date
  • Net 30 group = original WHMCS due date + 30 days
  • Net 60 group = original WHMCS due date + 60 days

Important detail

The best approach turned out to be using the original WHMCS invoice due date as the base date, instead of the invoice date itself.

That preserves native WHMCS behavior for standard clients, including cases where invoices are generated in advance.

So for example, if WHMCS generates an invoice 7 days before renewal:

  • standard client = keeps those 7 days
  • Net 30 client = 7 + 30 days
  • Net 60 client = 7 + 60 days

Why InvoiceCreation and not InvoiceCreated?

Because InvoiceCreated is too late if you want the invoice email to already contain the correct due date.

What this does NOT change

This hook only changes the invoice due date.

It does not change:

  • service Next Due Date
  • renewal logic
  • suspension logic

So suspension still needs to be handled separately depending on your business rules.

Why I’m sharing it

I found many posts about Net 30 / invoice due dates / payment terms in WHMCS, so I thought this might be useful for others too.

Hope it helps someone. Feedback and improvements are welcome.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated