tags:

views:

102

answers:

2

Our website uses a credit system to allow users to purchase inexpensive digital goods (eg. photos). We use credits, rather than asking the user to pay for items individually, because the items are cheap and we are trying to keep our credit-card/PayPal overhead low.

Because we aren't a bank, we have to expire credits after a certain amount of time. We expire deposit credits after a year, but other types of credits (bonuses, prizes, refunds) may have a different shelf-life. When a buyer buys an item, we spend the credit that is going to expire first.

Our current system keeps track of every deposit by storing the original value and the remainder to be spent. We keep a list of all purchases as well, of course.

I am currently moving to a system which is much more like a traditional double-entry accounting system. A deposit will create a ledger item, increasing the user's 'spending' account balance. Every purchase will also create a ledger item, decreasing the user's 'spending' account balance. The new system has running balances, while the old system does not, which greatly improves our ability to find problems and do reconciliations.

We do not want to use the old system of keeping a 'remainder' value attached to each deposit record because it is inefficient to replay a user's activities to calculate what the remainder of each deposit is over time (for the user's statement).

So, after all of this verbose introduction, my question is "Does anyone else out there have a similar system of expiring credits?" If you could describe how you calculate expired credits it would be a great help.

If all expired credits had the exact same shelf life, we would be able to calculate the expired amount using:

Total Deposits - Total Spending - Deposits Not Due To Expire = Amount to Expire

However, because deposits can have different shelf lives, this formula does not work because more than one deposit can be partially spent at any given time.

A: 

No, I don't have a similar system, but it sounds like you should probably add the expired credits to the ledger as debits.

too much php
I definitely will be recording the expired credits in the same ledger. It is calculating the value that is the tricky part.
A: 

Gareth, I know I'm late to come along but did you ever find a good solution for this? I am implementing something similar.

Hey user211570,In the end we went a completely different way. When a user deposited funds, we extended ALL of their existing funds. It was super easy to implement, we don't have to track expiry per deposit any more, and it is fairer for the users. The business is much more interested in keeping users happy than making money off expired deposits, which is cool. (This is the opposite of phone companies, who make their profits off unused credits).