Server Exports (Banking)
Below are all available server-side exports provided by bablo-banking. These helpers handle account lookups, balance changes, card checks, and society/default account utilities for ESX/QBCORE/QBOX setups.
Notes:
- All money mutation functions return
{ success: boolean, newBalance?: number, message?: string }. messageis present whensuccessisfalse(e.g.,ACCOUNT_NOT_FOUND,INSUFFICIENT_FUNDS,CARD_FROZEN).- Amounts are numbers; positive values are expected unless otherwise stated.
AddMoney
-- accountId: string - bank account number
-- amount: number - amount to add
-- description?: string - optional transaction text
-- isAtm?: boolean - when true, applies ATM-specific logic for default accounts
-- actorIdentifier?: string - identifier of the actor performing the action (ATM path)
-- return: { success: boolean, newBalance?: number, message?: string }
local result = exports["bablo-banking"]:AddMoney(accountId, 2500, "External Credit")RemoveMoney
-- accountId: string
-- amount: number
-- description?: string
-- isAtm?: boolean
-- actorIdentifier?: string
-- return: { success: boolean, newBalance?: number, message?: string }
local result = exports["bablo-banking"]:RemoveMoney(accountId, 500, "External Debit")RemoveMoneyByCard
-- accountId: string
-- amount: number
-- cardNumber: string
-- descriptionOrOpts?: string | { description?: string, isAtm?: boolean, actorIdentifier?: string, cardNumber?: string, allowNegative?: boolean }
-- return: { success: boolean, newBalance?: number, message?: string }
local ok = exports["bablo-banking"]:RemoveMoneyByCard(accountId, 100, cardNumber, "POS Payment")AddMoneyByCard
-- accountId: string
-- amount: number
-- cardNumber: string
-- description?: string
-- return: { success: boolean, newBalance?: number, message?: string }
local res = exports["bablo-banking"]:AddMoneyByCard(accountId, 100, cardNumber, "Card Refund")AddSocietyMoney
-- jobName: string - e.g. "police", "mechanic"
-- amount: number
-- description?: string
-- return: { success: boolean, newBalance?: number, message?: string }
local res = exports["bablo-banking"]:AddSocietyMoney("police", 5000, "Society Credit [police]")RemoveSocietyMoney
-- jobName: string
-- amount: number
-- opts?: { description?: string, isAtm?: boolean, actorIdentifier?: string, cardNumber?: string, allowNegative?: boolean }
-- return: { success: boolean, newBalance?: number, message?: string }
local res = exports["bablo-banking"]:RemoveSocietyMoney("police", 1000, { description = "Society Purchase" })AddSocietyMoneyForSource
-- source: number
-- amount: number
-- description?: string
-- return: { success: boolean, newBalance?: number, message?: string }
local res = exports["bablo-banking"]:AddSocietyMoneyForSource(source, 750, "Bonus Allocation")RemoveSocietyMoneyForSource
-- source: number
-- amount: number
-- opts?: { description?: string, isAtm?: boolean, actorIdentifier?: string, cardNumber?: string, allowNegative?: boolean }
-- return: { success: boolean, newBalance?: number, message?: string }
local res = exports["bablo-banking"]:RemoveSocietyMoneyForSource(source, 300, { description = "Uniform Purchase" })RemoveDefaultMoney
-- source: number
-- amount: number
-- opts?: { description?: string, isAtm?: boolean, actorIdentifier?: string, cardNumber?: string, allowNegative?: boolean }
-- return: { success: boolean, newBalance?: number, message?: string }
local res = exports["bablo-banking"]:RemoveDefaultMoney(source, 200, { description = "ATM Withdrawal" })RemoveDefaultByCard
-- source: number
-- amount: number
-- cardNumber: string
-- description?: string
-- return: { success: boolean, newBalance?: number, message?: string }
local res = exports["bablo-banking"]:RemoveDefaultByCard(source, 50, cardNumber, "POS Purchase")CreateTransaction
-- accountId: string -- e.g. "B123456789" or "BPOLICE"
-- txnType: "deposit" | "withdraw" | "transfer" | string
-- text: string -- human-readable description
-- amount: number -- SIGNED: see type rules below
-- cardNumber?: string -- optional; '' if none
-- return: { success: boolean, transactionId?: number, message?: string }
local res = exports["bablo-banking"]:CreateTransaction("B123456789", "deposit", "Cash Deposit", 500)CreateDefaultTransaction
-- sourceOrIdentifier: number | string -- player source OR identifier (e.g., "AHU78510")
-- txnType: "deposit" | "withdraw" | "transfer" | string
-- text: string
-- amount: number -- SIGNED: see type rules above
-- cardNumber?: string -- optional; '' if none
-- return: { success: boolean, transactionId?: number, message?: string }
local res = exports["bablo-banking"]:CreateDefaultTransaction(source, "withdraw", "ATM Withdrawal", -200)AddDefaultByCard
-- source: number
-- amount: number
-- cardNumber: string
-- description?: string
-- return: { success: boolean, newBalance?: number, message?: string }
local res = exports["bablo-banking"]:AddDefaultByCard(source, 50, cardNumber, "POS Refund")GetAccountFromCard
-- cardNumber: string
-- return: string|nil - linked account number or nil
local accountId = exports["bablo-banking"]:GetAccountFromCard(cardNumber)GetBalanceFromCard
-- cardNumber: string
-- return: number - current balance for the linked account/card
local balance = exports["bablo-banking"]:GetBalanceFromCard(cardNumber)GetBalance
Works for any account — personal, shared, savings, and society. For accounts flagged as the player's default (wallet-backed), the balance is read from the framework's bank money (online) or the offline money store, so the number always reflects the source of truth. Returns 0 if the account doesn't exist.
-- accountId: string - bank account number (e.g. "B123456789" or "BPOLICE")
-- return: number - current balance (0 if account not found)
local balance = exports["bablo-banking"]:GetBalance("B123456789")GetSocietyBalance
-- jobName: string - e.g. "BPOLICE"
-- return: number - current balance for the society account
local balance = exports["bablo-banking"]:GetSocietyBalance("BPOLICE")IsCardFrozen
-- cardNumber: string
-- return: boolean|nil - true if frozen, false if active, nil if not found
local isFrozen = exports["bablo-banking"]:IsCardFrozen(cardNumber)GetCreditLimitFromCard
-- cardNumber: string
-- return: number limit, number used - configured limit (0 = unlimited), amount used in last 24h
local limit, used = exports["bablo-banking"]:GetCreditLimitFromCard(cardNumber)RegisterSociety
-- jobName: string -- e.g. "police" or "society_police"
-- opts?: {
-- accountNumber?: string, -- e.g., "BPOLICE"; autogenerated if omitted
-- label?: string, -- display name; defaults to jobName
-- access?: table -- e.g., { "boss", 3 }
-- }
-- return: { success: boolean, job?: string, accountNumber?: string, label?: string, message?: string }
local res = exports["bablo-banking"]:RegisterSociety('pizza', {
accountNumber = 'BPIZZA01',
label = 'Pizza Co.',
access = { 'boss', 2 }
})FreezeAccount
Freezes a bank account, blocking all deposits and withdrawals. If the account is already frozen the call is a no-op and still returns success = true. Optionally pass a source to trigger a webhook log entry.
-- accountId: string - bank account number (e.g. "B123456789")
-- source?: number - player server id of the actor (used for webhook; optional)
-- return: { success: boolean, isFrozen?: boolean, message?: string }
local result = exports["bablo-banking"]:FreezeAccount("B123456789")
local result = exports["bablo-banking"]:FreezeAccount("B123456789", source)Possible message values on failure: INVALID_PARAMS, ACCOUNT_NOT_FOUND, DB_ERROR
UnfreezeAccount
Unfreezes a previously frozen bank account, restoring normal access. If the account is already active the call is a no-op and still returns success = true. Optionally pass a source to trigger a webhook log entry.
-- accountId: string - bank account number (e.g. "B123456789")
-- source?: number - player server id of the actor (used for webhook; optional)
-- return: { success: boolean, isFrozen?: boolean, message?: string }
local result = exports["bablo-banking"]:UnfreezeAccount("B123456789")
local result = exports["bablo-banking"]:UnfreezeAccount("B123456789", source)Possible message values on failure: INVALID_PARAMS, ACCOUNT_NOT_FOUND, DB_ERROR
IsAccountFrozen
Returns the frozen state of an account without modifying it.
-- accountId: string
-- return: boolean | nil — true if frozen, false if active, nil if account not found
local frozen = exports["bablo-banking"]:IsAccountFrozen("B123456789")
if frozen == nil then
-- account does not exist
elseif frozen then
-- account is frozen
else
-- account is active
endExportAccountTransactions
Exports the transaction history for an account. The calling player (source) must have access to the account (i.e. be in bablo_bank_account_users). Results can be returned as a Lua table or as a CSV string.
-- source: number - player server id (access is validated against their identifier)
-- accountId: string - bank account number
-- opts?: {
-- days?: number, - how many days back to fetch; -1 (default) returns all time
-- format?: "table" | "csv", - output format (default: "table")
-- maxRows?: number, - cap the number of rows returned
-- all?: boolean, - when true, overrides maxRows and returns every row
-- }
-- return (table format): { success: boolean, data?: Transaction[], message?: string }
-- return (csv format): { success: boolean, data?: string, message?: string }
-- Fetch last 30 days as a Lua table
local result = exports["bablo-banking"]:ExportAccountTransactions(source, "B123456789", { days = 30 })
-- Fetch all-time as CSV
local result = exports["bablo-banking"]:ExportAccountTransactions(source, "B123456789", {
format = "csv",
all = true
})
if result.success then
-- result.data is a table[] or CSV string depending on format
endEach Transaction table entry contains:
| Field | Type | Description |
|---|---|---|
id | number | Row index (1-based) |
type | "deposit" | "withdraw" | "transfer" | Transaction type |
name | string | Human-readable description |
date | string | Date in YYYY-MM-DD format |
amount | number | Signed amount (negative for withdrawals) |
accountIban | string | Account number the transaction belongs to |
cardNumber | string | nil | Card number used, if any |
Possible message values on failure: NO_IDENTIFIER, NO_ACCESS
Framework Hooks
Two overridable functions are defined on the Framework table inside each framework server file (frameworks/<framework>/server.lua). They fire every time money successfully moves through AddMoney, RemoveMoney, AddMoneyByCard, and the default/society/card wrappers that build on top of them. By default they're no-ops — override them to integrate with logging systems, Discord webhooks, stat trackers, etc.
Both hooks receive the same payload shape:
| Field | Type | Description |
|---|---|---|
accountNumber | string | The affected bank account number |
amount | number | Positive magnitude of the change (always > 0) |
description | string | Human-readable transaction text written to the ledger |
isAtm | boolean | true when the change came from an ATM path |
actorIdentifier | string | nil | Identifier of the player who performed the action, if known |
cardNumber | string | nil | Card used for the transaction, when applicable |
newBalance | number | Resulting balance after the mutation |
isDefault | boolean | true if the account is the owner's default (wallet-backed) account |
owner | string | nil | Identifier of the account owner (nil for society/unowned) |
Framework:onDeposit
-- Edit frameworks/<your-framework>/server.lua
function Framework:onDeposit(info)
print(('[deposit] %s +%s → %s (%s)'):format(
info.accountNumber, info.amount, info.newBalance, info.description
))
endFramework:onWithdrawal
-- Edit frameworks/<your-framework>/server.lua
function Framework:onWithdrawal(info)
if info.cardNumber then
print(('[withdraw] %s -%s via card %s'):format(
info.accountNumber, info.amount, info.cardNumber
))
end
endHooks are invoked inside a pcall, so exceptions thrown in your override won't break the underlying money mutation.