Original discussion

High level components

  • API gateway
  • Auth module
  • Payment service records txns seen by the user
    • txn, status, may have a list of ledger entries
  • Book keeping ledger service, keeps track of internal states
    • use double book keeping, i.e., need to differentiate debit and credit
    • Need to know which entry maps to which txn
  • Account balance service for users
    • May merge this as part of the ledger if distributed txn is not desirable
  • Proxy to 3rd party payment and settlement
  • MQ for the async notification from the main txn system

Requirement: our internal txn state should be consistent with external txn state

  • Recon job to scan pending txns after a period
  • provide webhook for 3rd party to ack success

Requirement: users may pay in different currencies

  • Introduce a centralized exchange service
  • Ledger keeps the currency and the original amount, with the rate recorded
  • Need extra ledger entry for internal txns