Help with a confusing scenario

Hey all, I need some help planning out a scenario and was hoping that
you guys could briefly explain how you would tackle the following
situation....

In my app., I want people to buy "credits", very similar to
iStockPhoto. I then want them to "claim" an item on the site, that
would take the necessary credits from their account. I plan to use
PayPal to process the user actually buying the credits (and this part
I pretty much understand). What I need help with is managing and
properly deducting the credits from each user as they claim items.

Can anyone provide a brief outline of how I should be thinking about
tackling this scenario? Thanks for any advice, input, or suggestions
you can recommend!

--Cory