My own "currency"

This is a little convoluted, I realize, but I have a client who wants me to create an online barter system wherein the site has its own "currency." (I think of them list istockphoto credits ... except that a user can either purchase credits or earn them by generating referrals.)

I don't begin to know how to do that. Any thoughts?