Exports

Server and client exports for integrating nc-banking V2 with other resources.

All examples assume the resource name is nc-banking:

local Banking = exports['nc-banking']

Server Exports

SendBill (server ID → server ID)

Send a bill using server IDs. Designed for job scripts (police, EMS, mechanic, etc.).

local ok, err = Banking:SendBill(
    fromSource,   -- sender server ID
    toSource,     -- recipient server ID
    5000,         -- amount
    'Speeding ticket', -- reason
    'police'      -- optional job name (e.g. 'police', 'ambulance')
)
-- Returns: boolean success, string? errorCode

Behavior:

  • Resolves both players via framework.
  • Converts to citizenid internally and uses the invoice system.
  • If job is provided, payment goes to that job's business account.

SendInvoice (citizenid → citizenid)

Send an invoice directly using citizenid values.

local ok = Banking:SendInvoice(
    fromCitizenid,   -- sender citizenid
    toCitizenid,     -- recipient citizenid
    5000,            -- amount
    'Vehicle repair',-- reason
    'mechanic',      -- optional job (target business account)
    "Mike's Garage" -- optional fromName (shown on invoice)
)
-- Returns: boolean

Use this when you already know citizenids (for example, internal tools or
back-office scripts).


GetCreditScore

Get a player's credit score and tier.

local credit = Banking:GetCreditScore(source)
-- credit = {
--   score       = number,
--   tier        = string,  -- e.g. 'Good'
--   maxLoan     = number,  -- max allowed loan
--   interestMod = number,  -- interest modifier from tier
-- }

Internally uses the same system as the bank UI.


Business Account Exports

These use job name only (no player source required) and operate on the
nc_banking_business table.

GetBusinessBalance

local balance = Banking:GetBusinessBalance('mechanic')
-- Returns: number (0 if not found)

AddBusinessMoney

local ok = Banking:AddBusinessMoney(
    'mechanic',       -- job name
    5000,             -- amount
    'External income' -- optional description
)
-- Returns: boolean
  • Fails if the business account does not exist or would exceed
    Config.MaxBusinessBalance.
  • Logs a business_deposit transaction as SYSTEM.

RemoveBusinessMoney

local ok = Banking:RemoveBusinessMoney(
    'mechanic',          -- job name
    2000,                -- amount
    'Supply purchase'    -- optional description
)
-- Returns: boolean (false if insufficient funds or not found)
  • Fails if the account has insufficient balance.
  • Logs a business_withdraw transaction as SYSTEM.

These exports are ideal for shops, tax systems, ticket/fine systems, towing,
etc., where money should flow through job business accounts instead of
directly to players.


Player & Account Helper Exports

These helpers expose core banking/account logic for other resources.

GetAccountData

local data = Banking:GetAccountData(source)
-- Returns a table with main balance, sub-accounts, and metadata used by the UI.

Intended mainly for tight integrations (custom UIs, dashboards) where you need
raw account structures.

GetTransactions

local tx = Banking:GetTransactions(citizenid, limit)
-- citizenid : string
-- limit     : number (optional, defaults to Config.TransactionLogLimit)
-- Returns: array of transaction rows

Useful for custom history UIs or external logging.

LogTransaction

Banking:LogTransaction(
    citizenid,
    txType,         -- e.g. 'deposit', 'withdraw', 'transfer_out', 'business_deposit', ...
    amount,
    balanceAfter,
    {
        description = 'Custom log from my script',
        accountType = 'business',
        accountId   = 12,
        -- any other metadata used by your integration
    }
)

Use this if your resource moves money outside of standard exports but you
still want the operation to appear in nc-banking history.

GetBankBalance / AddMoney / RemoveMoney

Thin wrappers around the framework bridge to keep your code decoupled.

local balance = Banking:GetBankBalance(source)

local ok = Banking:AddMoney(
    source,
    'bank',    -- 'bank' or 'cash' (depending on bridge)
    1000,
    'My Script Reward'
)

local ok2 = Banking:RemoveMoney(
    source,
    'bank',
    500,
    'My Script Fee'
)

These call into the framework-specific bridge so you do not have to handle
ESX/QBCore/ox_core differences yourself.


Client Exports

Billing App (Client)

Control the standalone billing UI from other client resources.

-- Open the billing app
exports['nc-banking']:OpenBillingApp()

-- Close it
exports['nc-banking']:CloseBillingApp()

-- Toggle it
exports['nc-banking']:ToggleBillingApp()

This uses the same UI that players can open via keybind or command, but lets you
attach it to your own menus or interactions.


Teller Tablet & Calibration (Client)

These exports come from client/tablet.lua and help integrate the teller
tablet / calibration with other tools.

ToggleTablet

exports['nc-banking']:ToggleTablet(true)   -- open tablet
exports['nc-banking']:ToggleTablet(false)  -- close tablet

IsTabletOpen / IsTabletReady

local isOpen  = exports['nc-banking']:IsTabletOpen()
local ready   = exports['nc-banking']:IsTabletReady()
  • IsTabletOpen() → whether the tablet UI is currently visible.
  • IsTabletReady() → whether calibration data and UI are ready to use.

GetTabletScreenPositions

local screen = exports['nc-banking']:GetTabletScreenPositions()
-- Returns calibration data used for the tablet alignment

Primarily useful for custom debug/overlay tools.


Banking Job Helpers (Client)

Exports related to the V2 banking job & branch system.

GetBankerRole

local role = exports['nc-banking']:GetBankerRole()
-- role = {
--   branchId = 'pacific',
--   role     = 'owner' | 'manager' | 'teller',
--   level    = 1 | 2 | 3,
-- }

Use this when you need to check, on the client side, whether the local player is
currently a banker and what their branch/role is (for example, to show extra UI
or integrate with other job scripts).

Last updated 1 month ago