I don’t know about the “proven solution”, as you put it, but I would strongly recommend not to store the dollar value in the database and increase or decrease this value in dollars. Instead, I would advise storing transactions that can be verified if something goes wrong. Calculate the amount available from credit and debit transactions in the user account, and not store it directly.
For added security, you want your application to not be able to delete transaction records. If for some reason you cannot ban write permissions in the corresponding tables, try repeating the transactions to the second database (which the application does not touch) as they are created.
source
share