Creating a billing system

I am a decent programmer i am not great, but i can only get better. i am in development of a billing system for my hosting site. would like to find out what your ideas are for setting this up. I was thinking a system similar to cpanels secret code that would only allow this software to communicate with this software as the identifier to allow it to create the new account once payment is recieved also allowing it to create the plans in the billing system and it will automatically be set in ehcp.

this would be a good thing.
if you can build/program a billing system, we can together make it work with ehcp.

The billing system (shortly BS) should communicate with ehcp like this:
* ehcp should have hosting plans, or something like that. those plan codes should be known to BS,
* the key/joint point of ehcp - BS should be something common to both, such as panelusername and hostingplan
* ehcp should be able to : check if a panelusername available, setup hosting by a call from BS, terminate the hosting upon request, or terminate hosting when expired,

Here is a scenario between BS and ehcp:
* BS accepts payment, has hosting plan known,
* BS asks ehcp for an available panelusername, some panelusername is agreed,
* BS asks ehcp to setup the hosting using some parameters (such as, expiredate, noexpire, deleteafterexpire etc..)
* ehcp setups the hosting and informs BS of successfull setup,
* BS completes order/setup.

We can work on this more..
I think I can adapt ehcp to this in reasonable time.
most functions in ehcp are ready for this.

Note that, I do coding in php, so you should do similar,

Wait for your comments...

it is written in php, i have already started it and it will allow people to setup there whole site how they want it to look so that it is not only just a billing section but a whole front end website with the ability to control all there info from the back side. i was looking at the bs being able to tell ehcp what the hosting requirements should be like if i want to set plan 1 to 20 gigs of bandwidth and 20 gigs hard drive it does it itself

This is possible in ehcp, using something like this:

in your php file do these:

$app = new Application();
$app->connectTodb(); # fill config.php with db user/pass for things to work..
$app->addDomainDirect( $domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,'active',$email,$quota); # to add passive, just use 'passive' instead of 'active'

Here, you call ehcp internal function from within your application.
Hosting plans not yet implemented in ehcp, you should tace care of plans on your side.
hope this helps.

This function also checks if those usernames are available.
you may check ehcp source, classapp.php file, that function.

I love the idea of a billing system for Ehcp. That would be amazing

I use EHCP =)


The api doesn't seem to be working. :(
I don't get any error, but it just doesn't add the account.
$app = new Application();
$domainname = "";
$panelusername = "test123";
$paneluserpass = "pass123";
$ftpusername = "123ftp";
$ftppassword = "ftppass";
$email = "2";
$quota = "1000";
$app->addDomainDirect( $domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,'active',$email,$quota); # to add passive, just use 'passive' instead of 'active'
This is in vhosts/


  • I assume, you want to run that api in server B, while ehcp is actually in server A (B->A)
  • classapp loads config.php in same dir, and reads mysql user pass and so on, so, your script should be able to connect to mysql of original ehcp server (A)
  • in original ehcp server, make sure you enabled mysql connection from your other server. to do that, in phpmyadmin, add a new user of ehcp, with same pass, where hostname is "not" localhost, but ip of B
  • you may check return value of $app->addDomainDirect, as it returns True, if successful, False, if not. examine that, or print that on screen..

    (note: related post:

  • It still doesn't work and i'v already done what you said before


    what is the error?
    r u able to see/show the error ?
    did you check return value of addDomainDirect.

    also, print $app->output to screen.
    the error should reside there.

    I get:

    Some Error Occured.
    Error:User is not active..: (Your account not active,contact your panel service provider, status: )



    I am going to try and make a system called Dime (just for the $0.10 USD currency). I will let you know how it goes...agreed we need a billing system. If anyone would like to work on Dime with me then jusst comment and I will try to post it to

    For more information see:

    --- TECNOGEEK ---

    Hey, Dime has gotten so far as to be able to create a new panel user with a domain name. To find out more or get the code visit:

    --- TECNOGEEK ---

    Progress Report:
    There is some headway with DIME, though it still has a long ways to go. DIME can now make free accounts which will lead into paid accounts. Our next step is going to be to create a package manager layer that communicates with this dime sudo API (I calll it sudo because it is pure cURL based and does not use the API from ECHP). You can see it in action too on, even signup for a free EHCP control panel account (Tutorial on

    --- TECNOGEEK ---

    Looking for a billing system to go with EHCP. Saw this post, I understand it is 2 yrs old but I am in end of such extension and I am willing to help just need the files so I can start plugging away at them.

    tell about what you want to do,
    I can help in building a provisioning system for ehcp.
    if required, start a new topic. give link here.

    To start where we left off I opened a new thread for the build process. Was able to get the old code for Dime. Link to repo on new thread here -

    Dime is no longer in active development. It is being replaced by a paid billing system I am working on. More details will come with time. I am hoping to give a demo soon as well as offer trials to those interested (trial will probably be a hosted solution for a few months free).

    --- TECNOGEEK ---

    well what i want to do is set the quota first of all. how much space how many domain names how many email all from what i have loaded in my script by using a command like that also i need ehcp to make sure that only and ehcp that should have access to this server is able to create it.

    so at this time there is no way to provision the system it is all based on some set of presets somewhere?
    also is there a way we can add a function that would require some kind of secret code so that only a software with that information could control it, also this would work nice for managing remote servers at other facilities with ehcp installed on them.

    function addNewCustomer($domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,$status,$maxdomains,$maxemails,$maxpanelusers,$maxftpusers,$maxdbs,$email='',$quota=0){


    ) return false;

    domain path will be like: /var/www/vhosts/ftpusername/
    /var/www/vhosts/ftpusername/ will be stored as homedir in domains table,
    one user will may have multiple domains with single ftp acount.
    to achive this, i must implement domain add to an existing ftp acount.
    $this->output.="Adding domain: $domainname";
    $s=$this->executeQuery("insert into ".$this->conf['domainstable']['tablename']." (reseller,panelusername,domainname,homedir,status,diskquota) values ('".$this->activeuser."','$panelusername','$domainname','$homedir','$status',$quota)",'domain add to ehcp db');
    $success=$success && ($s=$this->addDaemonOp("daemondomain","add",$domainname,$homedir,'domain info&ftp'));// since, adddaemonop only returns true or false, this construct is true, but above, execute may return other thing...
    $success=$success && ($s=$this->addDaemonOp("syncdomains",'','','','sync apache '));
    $success=$success && ($s=$this->addDaemonOp("syncdns",'','','','sync dns'));
    $success=$success && ($s=$this->addFtpUserDirect($panelusername,$ftpusername,$ftppassword,$this->conf['vhosts']."$ftpusername",$upload,$download,$quota,$domainname,'default'));
    $success=$success && ($s=$this->addPanelUserDirect($panelusername,$paneluserpass,$maxdomains,$maxemails,$maxpanelusers,$maxftpusers,$maxdbs,$quota,'',$email));

    $msg="ehcp: $domainname domain created in your ehcp panel at ".$this->conf['dnsip']." ";

    $msguser="ehcp: $domainname domain created in ehcp panel at http://".$this->conf['dnsip']." Your panelusername: $panelusername, Password: $paneluserpass, ftpusername: $ftpusername, ftp pass: $ftppassword ";
    if($email<>'') mail($email,"Your domain $domainname created in ehcp panel", $msguser,"From: ".$this->conf['adminemail']);

    return $this->ok_err_text($success,"All ops successfull. Adding domain complete..: $domainname",
    "Some domain operations are not successfull. Retry again, after deleting old data.");
    // rollback of operations when not succeeded, is not implemented. it just displays an error message... to be fixed later..


    $app = new Application();
    $app->addNewCustomer( $domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,'active',$maxdomains,$maxemails,$maxpanelusers,$maxftpusers,$maxdbs,$email,$quota);

    so far i have just hacked a little of your script together still working on adding some stuff to do it, basically it is a ready made function but i need to remove parts that will now be handled in the billing software.


    It still doesn't work and i'v done what you said already before.


    I get:

    Some Error Occured.
    Error:User is not active..: (Your account not active,contact your panel service provider, status: )


    sample codes are: (should work) (tested)

    Has any lead way been made on developing some type of billing system, or has a script been developed that will accept commands in order to setup a EHCP account.

    Our company / is a Technology consulting / web development firm for small business's. My business partner is a php web developer / designer and we are running EHCP on our inhouse server - and want to be able to have clients / potential customers choose which plan that we predetermined on our website front end. Then once they pay via paypal(Paypal then in returns transmits session data)to a php script that communicates to EHCP and creates the the account.

    If you have something else that is in development / beta we'd be happy to test it and or assist in development or pay for the ability as a custom development project.

    We love the simplicity of EHCP, it's low resource foot print, layout, ability to customize themes, ability to operate behind a firewall (unlike CPanel or other Panel software) and the new version which features the ubuntu theme which is very sleek. Not to mention it is open source which we are big supporters of.

    Please let me know, I sent a email t you directly from my account.

    I look forward to speaking with you.


    First, thank you, and congratulate you that you found ehcp, you found it to be useful.

    1- we are working on some intervals for a API that is making ehcp "reachable" and "controllable" from an outside script. look inside newest ehcp archive, api dir. you will find two examples. your php programmer/partner may understand the api i think. We may improve this api, as the requests arise and as we have time.
    By using this api, you can instruct ehcp to setu an account, (hopefully terminate it and so on.)

    2- I did not understand your second issue. please explain. what you mean by "custom coding front end", and "account creation backend. " what type of account ?

    3- all sources, notes, tutorials, advice is on internet,, the wiki, forums.. everything is opensource, no secret. have look at links in site. especially top links and left navigation links.

    Know that, ehcp is being improved by suggestions of all over the world,
    I try to implement the feature requests, suggestions as much as I have time, and as long as they conform with ehcp philosopy (simplicity in usage and programming, design)

    Normally, you dont need to pay for any development, since this is an opensource/free project.
    You may even modify and re-brand ehcp codes.
    Ways of donation are told in

    however, if you want some more specific things, or if you want something to be done in a specific time, you may pay some cash.
    I always prefer doing things, that are usable by everybody.

    see you,

    development plans in the billing system and automatically sets the ehcp based on this software: I'm in the process of creating this connection
    Consider other software but is for my proposal. Maybe someone has other suggestions?

    Let me know if you need help testing or w.e

    Possible, but not easy! I work for a company that creates Cable Billing software and we have been doing it for over 20 years and with over 5 developers. The process is ever growing and very in depth. Although cable is not phone we do handle Voip billing and authorization of services.


    I know it has been a long time since I posted Dime. I have pretty much abandoned Dime but am working on a paid billing system that supports multiple control panels. I think it is getting very close to being completed (should be done within one to two months). I will be making an EHCP module for it depending on interest.

    The limitations it will have (at least with the first release) is that you will have to use Stripe ( for your credit card processing. It uses the JavaScript version of Stripe so all you need is an SSL certificate and you are good to go.

    If any of you reading this thread are interested, please fill out the Google form found at and depending on demand I will let you know when the system is available for purchase.

    --- TECNOGEEK ---

    Hi if you could get this billing system up and working on this control panel i would like to try it

    Hi, I would just like to give you a status update. The billing system is still progressing but it is going much slower than I initially anticipated. It currently works (somewhat) and has two modules, one for Virtualizor and one for DirectAdmin.

    I will try and build a EHCP module over this weekend and provide an online demo to the billing system. People will be able to plug in their own EHCP server details but I will not be providing one due to budget constraints. I will probably have the system reset every one or two hours as well.

    --- TECNOGEEK ---