Skip to content

Financial ​

Port: REST :3060 · gRPC :5060

Manages the full financial lifecycle: accounts group wallets, wallets hold balances, invoices represent obligations, and transactions record atomic monetary movements. All transactions are saga-linked.

Collections ​

CollectionPathPurpose
Accounts/financial/accountsGroups one or more wallets
Currencies/financial/currenciesFiat, virtual, and chain currency definitions
Invoices/financial/invoicesBilling documents with payees, line items, and optional recurrence
Transactions/financial/transactionsAtomic monetary movement records
Wallets/financial/walletsBalance-holding wallet tied to one account and currency

financial/accounts ​

Groups one or more wallets and defines ownership semantics.

Required Create Fields ​

FieldRequiredTypeDescription
type✅AccountTypeCHECKING, SAVINGS, FIXED_DEPOSIT, MONEY_MARKET, JOINT, STUDENT, BUSINESS
ownership✅AccountOwnershipCOMMON, PERSONAL, GOVERNMENT

Optional Fields ​

FieldTypeDescription
membersMongoId[]User IDs with access

financial/currencies ​

Fiat, virtual, and blockchain-related currency metadata.

Required Create Fields ​

FieldRequiredTypeDescription
symbol✅stringDisplay symbol
type✅CurrencyTypeREAL, VIRTUAL
precision✅integer ≥ 0Decimal precision

Optional Fields ​

FieldTypeDescription
codestringShort code
namestringDisplay name
countriesstring[]ISO 3166-1 Alpha-3 codes
tokenstringToken identifier
networkstringBlockchain network
contractstringContract address
categoryCurrencyCategoryCOIN, TOKEN
libCurrencyLibIntegration library
nodesstring[]RPC node URLs
subunitsCurrencyUnit[]Nested unit definitions

financial/invoices ​

Represents a financial obligation with payees, optional payers, line items, and optional recurrence.

Required Create Fields ​

FieldRequiredTypeDescription
amount✅number ≥ 0Total invoice amount
payees✅Pay[]Non-empty recipient array

Optional Fields ​

FieldTypeDescription
typeInvoiceTypeTRANSACTION, REPEATABLE, REPLICATION, SUBSCRIPTION
titlestringInvoice title
payersPay[]Payment source wallets
currencyMongoIdfinancial/currencies
itemsInvoiceItem[]Line items
discountnumberDiscount amount
expires_atdateExpiration time
subscriptioncron stringRecurrence rule (for SUBSCRIPTION type)

Special Operation ​

OperationHTTPPurpose
paymentGET /financial/invoices/:id/paymentConvert invoice into a transaction flow

Invoice payment is a special operation, not a generic update. It requires the payment:financial:invoices scope.

Population ​

PathCollection
currencyfinancial/currencies
payees.walletfinancial/wallets
payers.walletfinancial/wallets

financial/transactions ​

Atomic monetary movement. Every transaction is linked to a saga.

create (raw CRUD) vs init (platform REST) are different operations. Use init for normal payment flows.

POST /financial/transactions/init
FieldRequiredTypeDescription
reason✅TransactionReasonSYNC, DEPOSIT, TRANSFER, WITHDRAW, PAYMENT
amount✅number ≥ 0Amount
saga—MongoIdIgnored — always overwritten. To join an existing saga send its id in the x-saga-session header
payers—Pay[]Source wallets
payees—Pay[]Destination wallets
invoice—MongoIdLinked invoice

Platform manages state, failed_at, verified_at, canceled_at — never set these manually during init.

How init, verify and the TTL fit together:

  • Saga binding — init reads only the x-saga-session header. With it, the transaction joins that saga (which must exist) and inherits its ttl; without it, init starts a new saga (ttl from x-saga-ttl, else the default). Either way it writes the saga id into saga, replacing any body value.
  • init reserves the payers' money, stores the transaction as PENDING, and schedules a rollback job to fire after the saga ttl.
  • verify is what commits: it marks the transaction VERIFIED, executes the transfer, and cancels the rollback job. Without an x-saga-session header it then commits the transaction's saga; with one (which must equal the transaction's saga) the saga is left for its owner to commit. A failed transfer marks the transaction FAILED and aborts the saga.
  • TTL expiry cancels — if neither verify nor abort runs before the ttl elapses, the rollback job marks the transaction CANCELLED and releases the reserved money.

Special Operations ​

OperationHTTPPurpose
abortGET /financial/transactions/:id/abortAbort a pending/in-flight transaction
verifyGET /financial/transactions/:id/verifyVerify a transaction

Population ​

PathCollection
sagaessential/sagas
invoicefinancial/invoices
payees.wallet / payers.walletfinancial/wallets

financial/wallets ​

Digital wallet tied to one account and one currency.

Required Create Fields ​

FieldRequiredTypeDescription
account✅MongoIdfinancial/accounts
currency✅MongoIdfinancial/currencies
amount✅numberPrimary balance

Optional Fields ​

FieldTypeDescription
blockednumberReserved / frozen balance
internalnumberInternal ledger balance
externalnumberExternal ledger balance
addressstringWallet address
privatestringPrivate key — write-only, never returned

Population ​

PathCollection
accountfinancial/accounts
currencyfinancial/currencies

Pay — Shared Nested Object ​

Used in both invoices and transactions for wallet payment entries.

FieldRequiredTypeDescription
type✅PayTypeAMOUNT, BLOCKED, INTERNAL, EXTERNAL
wallet✅MongoIdTarget wallet
amount—numberFixed amount
fraction—numberProportional fraction (0–1)

Use either amount or fraction for a given entry — not both.