Skip to content

Exports ​

All exports are called as exports.np_banking:<name>(...). The resource's own test suite checks this list against the code in both directions.

  • Money is whole dollars (integers). Amounts must be positive whole numbers up to Config.MaxAmount; fractions are refused, never rounded.
  • Exports answer nil / false / {} until np_banking is ready (np_banking:server:ready).
  • Account arguments accept the account id (acc_…) or the account number (LS-48 1192, also typed loosely: ls481192).
  • Errors are lower-case codes (funds, frozen, not_found, …). See Error codes.

Server ​

server

np_payments provider contract ​

np_payments' banking bridge calls these. You can use them from any resource too.

Export Returns Notes
ListAccounts(src) Account[] Every account the character may use, checking first. Account shape
GetAccount(id) { id, bank, type, label, number, owner, job, frozen, closed, balance } | nil
Charge(id, amount, meta) true, tx | false, err meta = { reason, actor = src, merchant?, category?, request?, card?, contactless?, location? }. Personal / shared accounts check the actor's role and daily member limit; job accounts trust the caller. meta.card checks the card (state, account, daily limit, contactless)
Credit(id, amount, meta) true, tx | false, err meta.refund = true writes a refund row
GetSocietyAccount(job) account id | nil Created on first use (Config.Accounts.societies)
CreditCitizen(identifier, amount, reason, meta?) bool The character's checking account, online or offline. Optional meta preserves traceRef, counterpartyHolder, cause and world for contextual payouts.
GetCardForItem(metadata, src?) { id, account, label, number, owner, holder, bank, tier, frozen, balance } | nil metadata.card = card id
IsCardFrozen(cardId) bool Frozen, blocked, expired, or its account frozen
CheckPin(src, { account, card? }, pin) bool Without card: the caller's own card on that account. Config.Cards.maxTries wrong PINs block the card
BlockCard(cardId, reason?) bool For good (replace at a branch)
GetAccountMembers(id) identifier[] Owner first

More exports ​

Export Returns Notes
GetPersonalAccount(src | identifier) Account | nil The checking account (created if missing)
GetBalance(src | identifier) number Checking balance. On esx / qbx / qb this equals the framework bank
GetAccounts(src | identifier) Account[] Like ListAccounts, also for offline characters (without the job account)
GetAccountByNumber(number) like GetAccount | nil
Transfer(fromId, toId, amount, meta?) true, { ref, out, in?, fee?, pending? } | false, err Between banks the money arrives after Config.Banks.transferDelayMinutes (pending). meta.instant = true pays the bank's instant fee instead, meta.delay = false skips the delay without a fee. meta.actor = src checks the actor's role
AddTransaction(id, signedAmount, meta?) true, tx | false, err Trusted booking: > 0 credits, < 0 charges. meta.ignoreFrozen for fines and seizures
GetTransactions(id, limit?, before?) tx[] newest first before = transaction id (paging)
CreateAccount({ type, owner?, job?, bank?, label?, members? }) account | nil, err members = { { identifier, role, limit? } }
AddMember(id, identifier, role, { limit?, name? }?) member | nil, err role = 'owner' | 'spend' | 'view', limit = daily spending of that member
RemoveMember(id, identifier) true | nil, err
FreezeAccount(id, frozen?) bool Audited
IssueCard(src | identifier, accountId, { tier?, pin?, give? }?) card | nil, err Gives the bank_card item unless give = false
FreezeCard(cardId, frozen?) bool
GetCards(src | identifier) Card[] Card shape
Deposit(src, amount, accountId?) true, tx | false, err Framework cash → checking (or accountId)
Withdraw(src, amount, accountId?) true, tx | false, err Account → framework cash
GetBanks() { id, name, full, short, primary, secondary, tint, logo, mark, tile, retail }[] The lore banks
lua
-- a job's payroll run from your own script
local society = exports.np_banking:GetSocietyAccount('mechanic')
for _, emp in ipairs(employees) do
  local to = exports.np_banking:GetPersonalAccount(emp.identifier)
  local ok, res = exports.np_banking:Transfer(society, to.id, emp.wage, { reason = 'Salary', type = 'salary', delay = false })
  if not ok then print(('payroll %s failed: %s'):format(emp.identifier, res)) end
end

-- a gym membership card on a shared account
local acc = exports.np_banking:CreateAccount({ type = 'shared', owner = identifier, bank = 'fleeca', label = 'Gym club' })
exports.np_banking:AddMember(acc.id, friendIdentifier, 'spend', { limit = 200 })

ATM exports ​

Export Returns Notes
RestockAtm(id, amount) added (whole dollars) | false, err Cash-in-transit jobs: adds cash up to the ATM's capacity, audited with the calling resource
GetAtm(id) { id, bank, label, model, coords, cash, capacity, state, brokenUntil, refilledAt, outOfCash, inUse, skimmer } | nil state = 'ok' | 'broken' | 'hacked'. Ids are atm_<model>_<x>_<y>_<z> (decimetres) or the configured location id
SetAtmState(id, state, data?) bool 'ok' | 'broken' | 'hacked'. broken: data.minutes or data.until (unix s); hacked: the glitch screen { title?, lines?, alarm?, progress?, progressLabel? }. Any state but ok ends the session there (the card goes back to its owner)

Branch exports ​

who = server id or character identifier.

Export Returns Notes
GetDeposits(who) Deposit[] Open savings depots: { id, product, kind = 'flex' | 'fixed' | 'index', amount, principal, rate, termDays?, openedAt, maturesAt?, status, account, bank, branch, value, earned, atMaturity?, locked?, units?, buyPrice?, change? }
GetLoans(who) Loan[] Active and pending loans: { id, kind = 'personal' | 'car' | 'mortgage', bank, account, principal, balance, rate, instalment, intervalDays, nextAt, missed, status, collateral?, createdAt, weeks, total, paidCount, count, repossess, approvedBy?, branch }
GetBoxes(who) Box[] Safe deposit boxes held or co-held: { id, label, bank, branch, branchLabel, size, sizeLabel, slots, weight, rent, paidUntil, sealed, owed, role = 'holder' | 'coholder', holders, log, keys, account }
GetBranchSummary(who) { deposits, loans, boxes, notices, credit, savingsTotal, debt } | nil Everything above plus large-cash notices { id, account, amount, readyAt, expiresAt, status, ready, branch } and the credit view { score, band, min, max, history, debt, paid, missed, ageDays }

Shapes ​

Account ​

lua
{
  id = 'acc_1a2b3c4d',
  type = 'checking',     -- 'checking' | 'personal' | 'savings' | 'shared' | 'business' | 'society' | 'faction' | 'government'
  label = 'Personal', bank = 'maze', bankLabel = 'Maze Bank', number = 'LS-48 1192',
  sub = 'Maze Bank · LS-48 1192',
  badge = 'Main',        -- on the checking account only
  balance = 24580,
  role = 'owner',        -- 'owner' | 'spend' | 'view'
  job = nil,             -- job of a job account
  frozen = false,
  pinRequired = false,   -- Config.Accounts.pinForBankCharges, never for 'view'
  icon = 'building-columns', tint = 'red',   -- icon by account type, tint of the bank
  limit = nil,           -- { used, max }: the member's daily limit on a shared or job account
}

Card ​

lua
{ id, account, accountNumber, bank, tier, last4, number, holderName, state, frozen, blocked, expiresAt, expires,
  dailyLimit, contactless, hasPin, triesLeft }
-- state: 'ok' | 'frozen' | 'blocked' | 'expired' | 'account_frozen'

Transaction ​

lua
{ id, ref = 'TX-…', account, counterparty?, counterpartyIdent?, counterpartyLabel?, amount (signed), balance (after),
  type, reason?, actor?, actorName?, merchant?, category?, location?, card?, at (unix s) }

Client ​

client

Export Returns
IsUiOpen() bool: a focused np_banking screen is open (keep your own UI closed)
GetBanks() The lore banks (same as the server export)

Item exports ​

Usable items are also exported under the item name (bank_card, bank_cheque, atm_skimmer, …) for ox_inventory's server.export = 'np_banking.<item>'. They are not part of the API.