I try to create an MFS(mobile financial service/p2p money transfer, bank with limited work) for learning. The transaction looks difficult. The user can do 3 things with his account.

  1. Deposit money to an e-wallet
  2. Withdraw money from an e-wallet
  3. Send money to another user's e-wallet.

Deposit money: Users can do it 3 way

  • bank to e-wallet
  • credit card to e-wallet
  • Agent e-wallet account to my e-wallet account.

Withdraw money from:

  • Nearest e-wallet agent(maybe a shopkeeper. He gives the cash and the person transfers money to his e-wallet. For this work, he gets a commission.)
  • Helping banks ATM booths (not implemented right now)
  • Transfer money to a linked bank account.

Now the way I was thinking and stuck is.

enter image description here

Here I have a transaction-type table that has charges and tries to make a single transaction table. Questions arise.

  1. Cash out charges are distributed between company and agent. 1% for the company and 1% goes to the agent account.
  2. Send money from one e-wallet to another e-wallet we have to adjust 2 account's current balances. But suppose we add money from a bank account to my MFS at that time I do not have the access to edit the bank account's current balance. So what type of data or trigger methods I should insert then?
  3. Add money through an agent, has both sides of account access. We can debit from the agent account and credit it to my e-wallet account.

So, what should my optimized schema look like? Any resource specific to this is appreciatable.

N.B: Still do not understand? just think about

  1. One bank tries to transfer money from one account to another account.
  2. One person from X bank wants to transfer money to a person whose bank account is in Y bank. How do you design those transfers? Also, share some resources on backup plans and security for those transactions.
  • sorry, but what is MFS (prove of the curse of knowledge problem - for you it is obvisious)? If I had to write a bank app with possible tons of concurrent transactions I would write into the transaction table and handle the real bookings in the background by a separate task to prevent locks etc. Of course your transactions-table would need a status column (new, in_process, processed, failed, canceled) and the bookings would no longer in "real time" (they aren't in a real bank) Aug 22, 2022 at 9:24
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Aug 22, 2022 at 12:12
  • Hi @ThomasFranz. Sorry for the first writing. It's not that explanatory. I edit it now to describe more. Aug 22, 2022 at 15:35

1 Answer 1


Firstly, you will need some way to know what account did that transaction.

Secondly, if you can have a transaction between accounts, you will need to do the same for the receiver account.

I think this can help because it gives more possibilities than a complex single transaction table and it can be expanded.

For short you can have a 2 step transaction, meaning that you connect the account table to an intermediary table for the specific transaction that has the specific characteristics and after that you can connect it with the main transaction table. Here is the image used in the link and i think it's easier to understand.

  • You could improve your answer by providing a summary of whats on the link. Link-only answers are discouraged as they can disappear. Jan 16, 2023 at 0:07
  • @RohitGupta Thanks for the advice
    – VladP
    Jan 16, 2023 at 19:39
  • And I have upvoted it Jan 16, 2023 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.