Affiliates
WHMCS comes with a built in affiliates system. Affiliates are often key to a business in order to generate revenue by having others refer customers. So with that in mind, WHMCS has a comprehensive affiliate system featuring support for one time and recurring commissions, both percentage or fixed money values, payout delays, minimum withdrawal limits and live stats/info for affiliates from the client area.
Your WHMCS install generates a unique code for each client to use on their website eg: https://www.example.com/aff.php?aff=001 When a visitor clicks this link they will be taken to your site and a cookie saved on their computer. If the visitor then places an order for a product/service with the cookie present (it lasts for 3 Months by default) the client will earn a commission.
Contents
Configuration
To configure the affiliates system, go to Setup > General Settings and then select the Affiliates tab. From here you can set the initial bonus deposit amount, the minimum withdrawal level, the payout delay and the percentage to payout.
- Affiliate Earning Percentage - The default percentage to pay as commission on all products/services. This can be overidden on a per product basis when configuring a product. And you can then overide the commission settings further on a per client basis and set a specific commission rate for an individual affiliate, ideal for rewarding your best affiliates.
- Affiliate Bonus Deposit - the amount to default any new affiliates balance to - a way of offering an incentive to new affiliates so they'll reach their first withdrawal level quicker
- Affiliate Payout Amount - the amount at which you allow affiliates to withdraw their commission balance, for example $50 or more.
- Affiliate Commission Delay - the number of days to delay commission payments so that you aren't paying commissions as soon as you receive the order. See the Commission Delay section below for more info.
Any setup fee will be included in the initial commission. Thereafter recurring commissions are based upon the product's Recurring Amount.
Commission is earned for products/services (including configurable options) only. Commission is not earned on:
- Domain names
- Product Addons
- Upgrade Orders (however any recurring commissions will increase with the new renewal price)
- Manually created invoices
Setting Commission Per-Product
To offer a higher commission on a certain product navigate to Setup > Product/Services > Edit > Other tab. From here you can choose a percentage or fixed amount commission. Ticking the One Time Payout checkbox will give the commission only once. The default commission setting for WHMCS is recurring.
It is possible to disable commission entirely for an individual product from this page by selecting the No Commission option. This setting takes priority over the default commission; product commission > default commission. However, if either the client or the product commission are set to one time, that setting will override.
Setting Commission Per-Client
To offer a unique commission click the "View Affiliate Details" link on the Client's Summary Tab and you can set the commission as above. This setting will take priority over all others; client commission > product commission > default commission. However, if either the client or the product commission are set to one time, that setting will override.
Promotion Behaviour
If the referred client uses a promotional code to receive a discount when signing up and you have configured the affiliate to receive a percentage commission, the value of the commission will be reduced. If a fixed amount commission is configured then they will still receive the full value.
For example if a '3 months free' promo is used the affiliate gets the commission based on the first payment amount and then recurring amounts that the product is set to. So the user would get a percentage of zero and therefore zero for the first 3 months.
Upgrade Behaviour
If a referred client upgrades/downgrades their product then commissions the affiliate receives in future will also be adjusted to match the price of the new product. Commission payments already earned will be unaffected. There is no commission paid on the upgrade/downgrade order itself. This does not apply to one-time commissions.
Commission Delay
This option allows you to set the number of days to delay commission payments so that you aren't paying affiliates as soon as you receive an order. This means you avoid paying commission on fraudulent orders or those cancelled within a few days of ordering as the commission is only paid if the product/service is still active at the end of the delay period.
The way this works is that instead of paying commission instantly when you are paid, it waits for a period of days and then only pays the commission should the product or service still be active after that period of time has passed. For example you could set it to wait 60 days before paying the commission for a sale on the basis that most fraudulent transactions will have been reported to you within that time. At the time of order, the affiliates Pending Commissions Balance will increase by the amount of commission for the order, but not their Available to Withdraw Balance.
You can view and delete pending commissions from the affiliates management area anytime from the Pending Commissions tab under Clients > Manage Affiliates when viewing an individual affiliates details.
Affiliate Linking Code
You can specify affiliate link code in the config area. Below is an example:
<a href="[AffiliateLinkCode]"><img src="http://www.yourcompany.com/banners/468x60banner.gif" width="468" height="60" border="0"></a><br>
<(a href="[AffiliateLinkCode]")><(img src="http://www.yourcompany.com/banners/468x60banner.gif" width="468" height="60" border="0")><(/a)><br><br>
<a href="[AffiliateLinkCode]"><img src="http://www.yourcompany.com/banners/120x60banner.gif" width="120" height="60" border="0"></a><br>
<(a href="[AffiliateLinkCode]")><(img src="http://www.yourcompany.com/banners/120x60banner.gif" width="120" height="60" border="0")><(/a)><br><br>
The above code entered in the Affiliates Link section will display the image preview of the banner first and then the code below it for the affiliate to use. The <( and )> is special syntax which you must use so the code is not executed as true HTML. WHMCS modifies this when displaying it to the client so it will appear as normal HTML.
For more advanced link code, you can add it directly to the affiliates.tpl template file of your active template folder using the template field {$referrallink} wherever you want to include the affiliates unique referral url.
Linking to a Product
It is possible to link directly to the order form for a specific product. To do this, simply append &pid=x to the end of the [AffiliateLinkCode] where x is replaced by the ID of the product. So for example:
<a href="[AffiliateLinkCode]&pid=2"><img src="http://www.yourcompany.com/banners/468x60banner.gif" width="468" height="60" border="0"></a><br> <(a href="[AffiliateLinkCode]&pid=2")><(img src=http://www.yourcompany.com/banners/468x60banner.gif" width="468" height="60" border="0")><(/a)>
Activating an Affiliate
Clients can activate their affiliate account from the client area but you as an admin can do it from the client summary page also. To do that, locate the client you want to activate using the search or client list and then in the Actions panel click the Activate as Affiliate link.
Deactivating an Affiliate
To remove a client from the affiliate program navigate to Clients > Manage Affiliates and click the red X icon next to their name.
Managing Affiliates
- To view & manage affiliates, go to Clients > Manage Affiliates
- To view the affiliate statistics for a specific client, search for that client as normal and from the Client Summary" page, click the View Affiliate Details link in the Actions panel
- To view your best performing affiliates, click the Balance column heading to resort the affiliates into order of balance
Referral Tracking
In WHMCS 7.5 and later, referral traffic is logged and recorded to allow you to see where referrals are coming from and trends in the volume of referrals over time.
The logged data includes the referrer url where possible, and the number of hits for each unique referral url.
You can choose between a range of time periods: 30 Days, 60 Days, 90 Days & 120 Days.
The referral tracking is displayed as the first tab within the affiliate profile view.
Manual Operations
Assigning an Affiliate to an Existing Order
To assign an affiliate to an order which has already been placed and shows no referral, go to Orders > List and locate the order you want to assign to the affiliate. Once located, click on the Order ID number to open the details for that order. Now click the Manual Assign link in the Affiliate section, and you will then get a popup with a dropdown where you can choose the affiliate you want to assign it to, and then click Save to apply it.
Paying Commission for an already paid order
There may be some instances where you apply an affiliate to an order after it has been paid for and that would mean the affiliate has then missed out on the initial commission for that order. To correct that, after assigning the affiliate with the steps above, open the affiliates page (see Managing Affiliates above) and then on the Referrals list for the affiliate, click the Manual Payout button next to the new account. That will perform the equivalent action of an invoice being paid by the end user for a referred order in terms of crediting the affiliate.
Manually Adding a Commission
Sometimes it might be necessary to give commission to an affiliate that is not related to any order, for example a special commission bonus, or if importing a commission balance from another affiliate system. To do this, open the affiliates page (see Managing Affiliates above) and click the Commissions History tab, you can then enter the details of the commission under the Add Manual Commission Entry' heading. If the commission relates to an existing referral you may select it from the 'Related Referral' menu, otherwise leave it as 'None'.
Affiliates Cookie
The affiliates cookie by default is set to last for 3 Months on the users computer. The cookie duration can be changed by editing the aff.php file.
Line 24 controls the creation of the cookie and how long it lasts:
Cookie::set('AffiliateID',$aff,'3m');
When editing this line, only the final argument should be altered. (3m)
The final argument defines the lifetime of the cookie and is based on PHP Timestamps. For convenience, we offer a helper when defining months. When months are required, specify the number of months and append "m" as shown in the example above.
We have provided some common examples of commonly used lifetimes below:
1 Day:
Cookie::set('AffiliateID', $aff, time() + (24*60*60));
7 Days:
Cookie::set('AffiliateID', $aff, time() + (7*24*60*60));
14 Days:
Cookie::set('AffiliateID', $aff, time() + (14*24*60*60));
1 Month:
Cookie::set('AffiliateID', $aff, '1m');
Multi Currency
When you select the %age it will pay x% of whatever currency the user pays you in and convert it to the affiliates' currency using the current exchange rate. If you select to pay a fixed amount that will be paid the same amount in any currency.
The Affiliate Bonus Deposit amount and Affiliate Payout Amount threshold are converted into the client's currency.
Making a Withdrawal (Paying Commission)
When an affiliate's balance reaches the affiliate payout amount a request withdrawal button appears on the client's affiliate page. If they click that to submit a request, it will open a ticket notifying you of their request.
To process the withdrawal request, simply navigate to the affiliates management page for the affiliate in question, select the Withdrawals History tab, and there you will see a form for making a withdrawal payout. This allows you to enter the withdrawal onto the system, automatically deducting the specified amount from the users affiliate balance, and performing some additional actions based on the Payout Type selection from the options below:
- Create Transaction to Client - This will automatically create an expenditure transaction on the clients account in WHMCS to reduce your profit figures for the client (you must still actually make the payment manually - Cheque, PayPal, etc...)
- Add Amount to Credit Balance - This will automatically create a credit on the clients account equal to the value of the withdrawal amount to be applied to the future invoices they receive from you
- Record in Withdrawals Only - This just makes a record of the withdrawal in the affiliates area and doesn't create any transaction or credit.
There may be occasions where it is necessary to manually give a client commission, for example if an order was handled outside WHMCS or you've imported from another billing system and want to transfer their affiliate balance across. This is where the Add Manual Commission Entry section on the Commissions History tab is used. A Related Referral can also be selected if the commission relates to a specific referral, leave the field at "None" if adding a general commission.