Web Billing

The site I'm working on has a billing component to it. Important concepts in the site are user and delivery. The site has one piece of billing logic that says a completed delivery costs 50 cents. How should a bill for a given user on a given month be computed?

The naive approach, plan A, is to scan all deliveries that happened within the given month and look for completed deliveries by the given user.

The next step up, plan B, is to keep a separate accounting journal for each user. Each completed delivery gets a journal entry. The journal is scanned for all transactions in that month.

Say the billing logic changes at some point, with plan A the old deliveries would be computed with the new logic. That probably is the wrong thing to do. With plan B, charges going forward would be computed with the new logic. On the other hand, if the logic were found to be faulty, plan A would be ideal and plan B means cleaning up all journal entries.

Another argument for plan B is to allow for adjustments outside the business logic. Perhaps there are transaction fees from paypal that are accounted for seperately. Those can be easily added to a journal, where as plan A could not capture that value. Maybe a specific customer should get a refund of $5 for whatever reason. Its easy to put that into the journal.

Then I think, why implement an accounting journal in the site at all? Aren't there accounting packages that are made for managing credits and debits? I would like the website to speak directly to an accounting package, adding new journal entries as needed. I don't know of an open source account/enterprise-planning/business-intelligence product that works this way. Do you? I imagine there are benefits to using a real accounting package, reports and such made by people who know accounting.

tags: