🗄️ Server exports
Common server exports for Finance 1.0.1. Call after startup, validate identity and prices server-side, and never expose money mutations as unrestricted network events.
Account lookup
Pass IBANs as strings, retaining leading zeros. Handle missing accounts; do not recreate them automatically or mutate returned tables to change money.
Society accounts and funds
CreateBusinessAccount(society, startBalance?, displayName?, color?) returns { success, error?, account? }. Existing accounts are not funded again. Funding failure can return an account with success = false; inspect before retrying.
AddSocietyMoney(society, amount) and RemoveSocietyMoney(society, amount) take positive amounts and return booleans. Restrictions, limits, or hooks can refuse them. Check for true; investigate exceptions or lost responses before repeating a payment.
Account and card status
Use numeric card database IDs, not card numbers or slots. See Account freezes. Do not synchronously freeze an account from its own operation hook; the export can wait on its lock.
Transaction history
toIban, fromIban, description, playerIdentifier, cardId, and customTitle can be omitted with nil where they do not apply. transactionType is a string and amount a number. The result is a transaction ID or nil.
History only: no money movement or cashback.
Invoices
CreateInvoice(invoiceData) returns the created invoice table or nil. A minimal company-to-player example is:
Configure mechanic first and resolve recipient variables server-side. Calculate total from items before tax. Omit taxPercentage to use configured tax. Finance generates id and display uuid.
Personal invoices require sender = '__personal' and the issuer's character identifier in senderId. Company recipients use recipientType = 'company' and their job identifier in recipientCompany; eligibility still applies. skipAcceptance = true makes an invoice unpaid immediately.
Creation trusts server callers and lacks the player path's online grade context. Validate client input and authorize acceptance bypasses yourself.
PayInvoice(playerSource, invoiceId) returns success and optionally the paid amount. CancelInvoice(playerSource, invoiceId) returns a boolean. Both enforce player/company permissions. Use the numeric invoice ID, not its display UUID.