fb-pixel

WHMCS credit note addon

Published in:

by:

One of the many limits of WHMCS is the ability to create a credit note to revert an invoice, this is why we needed to create this WHMCS credit note addon.

A request has been sitting there since 2015, I’m sure that even if it says planned it will sit there a few more years if not forever.

A credit note is important in those cases where we need to revert an invoice.

With this module, with a single click you can create a credit note and link it to the original invoice. There are many options like adding a credit to a client, using its own number sequence and more, as will be explained later with the configuration options.

Compatibility

WHMCS 7.x, WHMCS 8.x (all versions)

PHP 7.x

Features

This addon module allows you to create a credit note in a single click. From the addon configuration you can set these (more info in the configuration section below.

  • Create a credit note with negative or positive amounts
  • Set original invoice to cancelled or leave it as it is (you can only create credit notes for Paid invoices)
  • Decide if you want to add a credit to the client for the whole invoice amount
  • Use WHMCS invoice sequence, or give credit notes their own sequence
  • Decide the numbering format for credit notes (the same way you do with WHMCS invoices)
Whmcs Credit Note Config

Admin features

A simple click on a button to create the credit note

Whmcs Credit Note Create Credit Note
The button to create the credit note is only shown to those admin who have permission to access the module. The button is shown only for paid invoices.

When you view the invoice from the admin area you will see a button to open the credit note from the admin area (all admin can see this).

Whmcs Credit Note Invoice Link

When you view the credit note from the admin area you will see a button to open the related invoice (all admin can see this)

Whmcs Credit Note Credit Note Link

Client features

Displays a note in the invoice (online and pdf) to link it to the credit note.

Invoice Has Been Cancelled By A Credit Note

Displays a note in the credit note to link it to the invoice.

Credit Note Cancels Invoice Note

Installation

To install the WHMCS credit note addon you just need 2 things.

Upload the “credit_note” folder into WHMCS/modules/addon

Add this code at the beginning of the invoicepdf.tpl file, just after the opening php tag. Unfortunately there are no hooks for pdf invoice variable editing and this code is necessary to change the notes, invoice number and pagetitle in the pdf version of the invoice.

Code to add:

// credit invoice addon code
if (strpos($notes, 'Refund Invoice') !== false) {
    if (function_exists('credit_invoice_replace_notes'))
        $notes = credit_invoice_replace_notes($notes);
    if (function_exists('credit_invoice_replace_pagetitle'))
        $pagetitle = credit_invoice_replace_pagetitle($invoiceid, $pagetitle);
}
// end of credit invoice addon code

Module activation

Once in the WHMCS admin area, to activate the WHMCS credit note addon, click on the wrench icon in the top right corner, then click on “system settings”.

Whmcs Credit Note System Settings

Now search for “Addon modules” and click on the box to activate the addon.

Whmcs Addon Modules

Now locate the WHMCS credit note addon and activate, you can do that simply clicking the green button “Activate”.

Whmcs Credit Note Addon Activation

Now that the WHMCS credit note addon is active we can configure it.

WHMCS credit note configuration

Once you activate the module, you need to configure it properly. Let’s go through all the configurations one by one to see how to configure this addon the right way.

Clicking on configure open the configuration panel:

Whmcs Credit Note Config

License key

This field is self explanatory. Enter the license key you find in SupportHost’s client area, without it you won’t be able to create any credit note, even though you will see the button in the invoice.

Notes in the invoice will be shown correctly, even if you don’t have a valid license.

Negate invoice

When you create a credit note you can decide to set the amounts as negative or positive. If you want the amounts to be negative select this option, otherwise leave it unchecked.

NOTE: if the client paid the invoice with taxes, and now is tax exempt because he added a valid VAT or because the country changed, the invoice will contain taxes (negative or positive depends on this setting).

Set invoice to ‘Cancelled’

Select this option if you want to set to Cancelled the original invoice. Leave it unticked if you want to leave it in the Paid status.

Add credit to the client

If you want to add the amount paid to the client’s credit tick this option. The total of the invoice (items + taxes) will be added as credit to the client.

Give credit notes their own sequence

The normal behaviour of the addon is to not give invoices their own number sequence.

The default behaviour is to number the credit note using the invoice sequence.

Let’s assume you want to create a credit note for invoice #20, and the next invoice WHMCS will create is #35

In this case the addon will create credit note #35 and the next paid invoice will be #36

This is also true if you decided to use the “Sequential Paid Invoice Numbering” from general settings -> invoices, or if you use the same setting from the tax settings, the credit note will use the next sequential number.

If you tick this box credit notes will have their own sequence, so in the example above you will create creditnote #1 (assuming is the first credit note you create this year) and the next paid invoice will be #35

The credit note number sequence resets every year, so on January 1st it will automatically restart from #1

Credit notes numbering format

Here you can decide the number formatting for credit notes, the same way you do for the invoice from WHMCS general setttings or from tax settings.

You have these tags available:

{YEAR} {MONTH} {DAY} {NUMBER}

This setting only works if you decided to give credit notes their own numbering. Otherwise the invoice format from WHMCS will be used.

Text displayed on credit notes

This is the text that you will display in the credit note:

Credit Note Cancels Invoice Note

You can use the tag {NUMBER} to insert the invoice number.

Text displayed on invoice with credit note

This is the text that you will display in the invoice that has been cancelled by the credit note:

Invoice Has Been Cancelled By A Credit Note

You can use the tag {NUMBER} to insert the credit note number.

Credit note payment method

If you leave it as default, it will set the credit note with the same payment method as the original invoice.

You can decide to always set credit note with a specific payment method.

This way you can show the payment method you want in the credit note.

Change page title for credit notes

This is pretty self-explanatory. It changes the title and the text where the credit note number is displayed.

The best way to set this is to view the credit note as client and see how it’s diplayed.

Access Control

Here you can select the admin roles that have access to the addon. Only the admins with the roles you select here will have the possibility to create a credit note. All admins will see the linked invoice while checking a credit note, all admins will see the linked credit note when checking a cancelled invoice.

New features

Do you feel like some features are missing? Do you have any doubts on how to use this module? Drop a comment and I promise you we’ll do exactly the opposite of WHMCS: listen!


Try one of our hosting plans for free and without obligation for 14 days. No payment information required!

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *