codemaster2008 Posted January 23, 2010 Share Posted January 23, 2010 Hi; I was looking for some official information on this topic but i couldn't find it. I know whmcs handles overage billing and i believe it has a small number of supported control panels, however, speaking with Matt about it he told me (if i'm not mistaken) it could be integrated to any Control Panel, my question here is: how? Also, i was told that it will bill for the overage on the last day of each month. How that works? It will calculate on the last day of each month and them add it to the next invoice or it will send a separated invoice? Got me confused What i need is pretty simple: A) Set per user or per user group wether or not a user will be billed for overage or if his account will be suspended until the start of the next billing cycle when it reachs it's limits. B) Calculate daily the estimated usage and send a warning (email) to the customer informing that he "maybe" will go over his monthly limit. C) Send an email when the user goes over limit informing that he is already being billed for extra usage. D) Calculate the overage not on the last day of the month but for the billing cycle, before create the monthly invoice so the extra charge can be added on it. My (custom) control panel already does part of it (send the emails, enable/disable permission to overusage). I just think that would be good to transfer the responsibility to the billing system where all other billing related issues are handled. Also, my control panel has an API where the bandwidth usage can be returned for an interval of dates, someting like: GetUsage(accountId, startDate, endDate). At first i though the easiest way would be my cp use the whmcs api to add a new Billable Item one day before the invoice is generate. So, it would be included on the invoice but I don't even know if it works like that. I appreciate any comments o idea on how can get it to work. Thanks in advance. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted January 23, 2010 Share Posted January 23, 2010 In your custom server module you create a UsageUpdate function which when irun gets the bandwidth and disc usage of the users and updates the apropiate values in tblhosting in the whmcs DB. This is run once per day with the whmcs cron and should be updated. At the end of the month the invoices are created from the updated info. A) it is billed per product (set in the other tab) B) Does not do this but an action hook can be created to do this. C) Once again an action hook D) Maybe submit a feature request for this. 0 Quote Link to comment Share on other sites More sharing options...
codemaster2008 Posted January 23, 2010 Author Share Posted January 23, 2010 In your custom server module you create a UsageUpdate function [...] This is run once per day with the whmcs cron and should be updated [...] D) Maybe submit a feature request for this. First off all, thanks for the info. Very usefulll. So, it's actually updated daily on the WHMCS database but, a separated invoice will be create on the last day of the month? I can't see the logic on that. If the information is already there, why not include it on the regular bill? Anyways, to make things work the way i need, can i get the whmcs to query my api (daily) for the usage but "not create the bill" at the end of the month? This way i could do everything via action hooks as you sugested, right? I could check one day before the monthly invoice is generated and if there is overusage, create a billable item. Well, I'm assuming that a billable item will be included automaitcally on the next invoice, is that how it works? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted January 23, 2010 Share Posted January 23, 2010 If the information is already there, why not include it on the regular bill? I believe that it is mainly to do with the way cPanel does the bandwidth stats. Beginning to end of month. Anyways, to make things work the way i need, can i get the whmcs to query my api (daily) for the usage but "not create the bill" at the end of the month? Yes This way i could do everything via action hooks as you sugested, right? YesWell, I'm assuming that a billable item will be included automaitcally on the next invoice, is that how it works?Yes 0 Quote Link to comment Share on other sites More sharing options...
codemaster2008 Posted January 24, 2010 Author Share Posted January 24, 2010 You said i can get whmcs to call my api for bandwidth usage on a daily basis and not bill the client for that, how is it going to work? If i implement the "UsageUpdate" function on my module, do i have to tell whmcs to run it daily or it will happend automatically? Once this information is going to the DB, whmcs won't automatically generate a bill for that? Sorry for keeping asking so many questions, just want make sure I understood it weel before I start. 0 Quote Link to comment Share on other sites More sharing options...
codemaster2008 Posted January 24, 2010 Author Share Posted January 24, 2010 Quick Update: I didn't find the function "UsageUpdate" on the module development kit. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted January 24, 2010 Share Posted January 24, 2010 Yes you are correct... its not in the module dev kit, it probably should be updated with the latest info. 1) You should have already set your cron to run daily. 2) In admin -> setup -> Automation Settings down the bottom in Miscellaneous check "Update Usage Statistics" When this is checked the function in your server module is called. In your function you get the stats from your server and then update the stats fields in tblhosting in your DBFor an example if your server module was called freddy.php then the function should look like this function freddy_UsageUpdate($params) { ### Your code goes here ### } 3) If you want whmcs to create the overage invoice at the end of the month thenGo to Setup -> Products/Services and edit your product to both enable and set the overage pricing on the other tab.If you don't want the invoice generated for any users that has this product then don't enable it. For more info go to http://wiki.whmcs.com/Disk_Space_and_Bandwidth_Overage_Billing 0 Quote Link to comment Share on other sites More sharing options...
codemaster2008 Posted January 24, 2010 Author Share Posted January 24, 2010 Thanks a lot for all the information, you've being very helpful. 0 Quote Link to comment Share on other sites More sharing options...
merlinpa1969 Posted January 24, 2010 Share Posted January 24, 2010 If you look in the automation settngs when it talks about billing overages there is a switch there that will allow you to Calculate on the last day of the month but include on the next invoice to generate for the client 0 Quote Link to comment Share on other sites More sharing options...
Grizzlyware Josh Posted January 24, 2010 Share Posted January 24, 2010 Hi Codemaster, I made an addon last night which will send emails to your customers before or after they reach their limits... http://forum.whmcs.com/showthread.php?t=26682 Regards, Josh 0 Quote Link to comment Share on other sites More sharing options...
codemaster2008 Posted January 24, 2010 Author Share Posted January 24, 2010 I made an addon last night which will send emails to your customers before or after they reach their limits... Will check it out, thanks. 0 Quote Link to comment Share on other sites More sharing options...
swhitley Posted August 11, 2010 Share Posted August 11, 2010 I have everything setup correctly, but the "UsageUpdate" function is never called. I just want to write out a test to a file, but the file is never created. The create and terminate functions on this server module work fine. Any ideas? 0 Quote Link to comment Share on other sites More sharing options...
Kennethav Posted December 30, 2010 Share Posted December 30, 2010 I have everything setup correctly, but the "UsageUpdate" function is never called. I just want to write out a test to a file, but the file is never created. The create and terminate functions on this server module work fine. Any ideas? I'm also struggling with this one. The server module containing the function isn't even included from the cron job. I've also tried to put a function (#servermodulename#_UsageUpdate) in the prepend file however it's never called. The "Overages Billing" option is checked on the product and the activity log reports the following: Cron Job: Running Usage Stats Update Does anyone know how this should work or whether I've done something wrong? 0 Quote Link to comment Share on other sites More sharing options...
rack::SPEED Posted February 28, 2011 Share Posted February 28, 2011 You have to connect a server to your module to get UsageUpdate running. 0 Quote Link to comment Share on other sites More sharing options...
netwood Posted March 22, 2011 Share Posted March 22, 2011 <stupid newbie question> Where do you set the price - per MB - for the overage billing? </stupid newbie question> 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted March 23, 2011 WHMCS Support Manager Share Posted March 23, 2011 Setup > Products/Services > Edit > Other tab http://docs.whmcs.com/Disk_Space_and_Bandwidth_Overage_Billing 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.