I used the word "account" as in "accounting", I'm not talking about regular drupal user accounts. Here's what I am trying to do :
Users should each have the possibility to add money to their "account".
When they buy products, the total of their order is deducted from their "account".
The reason for this separation between payment and ordering is that the next step is to have a system of comissions, so that if a user you referred (I'm using the user_referral module for this) buys a product then a certain percentage of the price will be added to your account (you will then be able to use it to buy more product or to have it sent to you in the form of a check).
The database tables that would need to be added seem pretty clear to me, I think there is only a need for one table containing different types of transactions (money added manually, comissions, and payments for products with a negative value). I have a little experience developping custom modules, and with other ecommerce modules as examples the task shouldn't be too difficult. However, I am planning to contribute this module back to the community, so I'm interested in doing something that is done the right way and that is compatible with other ecommerce modules rather than having a quick hack that works but it useless to anyone else.
So if you have any suggestions about what I should use (existing modules or methods) or how I should do it, it would be greatly appreciated.