Jump to content

Bandwidth Overage Billing integration


codemaster2008

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Yes

Well, I'm assuming that a billable item will be included automaitcally on the next invoice, is that how it works?

Yes
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 DB

For 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 then
Go 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

Link to comment
Share on other sites

  • 6 months later...
  • 4 months later...
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?

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

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