Having written two billing systems in the past year, I'll never build one again.
There are certainly advantages to writing your own, we generate custom PDF receipts at GitHub that customers really seem to like, but the amount of time wasted building and maintaining the system was/is fairly substantial.
If I were to do it again, I'd use a hosted service that you can skin to look like your site and let them manage everything.