NX Creative

Exports

Public exports registered by nx_realbanking, split into server and client.

On this page

All server exports live under exports.nx_realbanking:<Name>(). Client exports use the same pattern inside a client-side script.

Server#

Integration API#

These exports read and move money without a source and without anyone online. Use them for scheduled or automated work: fuel station revenue, faction payroll, funding a faction from a government account.

Each one takes an account reference as its first argument. The same reference format covers all four kinds of account, and it accepts whichever identifier your resource already holds.

ReferenceResolves to
'ACC123456789'A nx_realbanking account (personal, business, savings)
12 or '12'The player on that server id
'player:12'The same, written explicitly
'citizen:ABC123'A framework identifier or citizenid, online or offline
'license:1a2b3c'A raw FiveM identifier (license, steam, discord, fivem, xbl, live)
'char1:1a2b3c'An ESX character identifier
'ACC_1730000000_1234'A company's account number (see Company accounts)
'society:police'A society account, resolved through Config.Societies
'society_police'The shared account name itself
'gov' or 'government'The configured government account

Bare strings are matched in that order, so 'ABC123' works for a citizenid and 'police' works for a job without a prefix. A table form is accepted too: { society = 'police' }, { citizen = 'ABC123' }, { source = 12 }, { government = true }, { account = 'ACC123' }.

Society and government balances are not stored by nx_realbanking. They live in esx_addonaccount on ESX and qb-management or qbx_management on QBCore, and these exports read and write them through whichever one your server runs. The account has to exist there first: paying into a society name that resource has never heard of returns SOCIETY_BACKEND_MISSING rather than writing money nowhere.

Every company also has its own account number, in the same ACC_… shape as a personal account. Players see that number in the bank app, and every export on this page takes it wherever society:<job> works, so a number a player typed or pasted can be passed straight through. society:<job> keeps working for scripts.

On ESX, addon_account_data.money is an integer column. Fractional amounts survive in memory but round when esx_addonaccount saves, so send society accounts whole numbers if the cents matter to you.

Overdraft#

Balances stop at zero. A debit that would go below it is refused with INSUFFICIENT_FUNDS and nothing is written.

Society and government accounts can be allowed to go negative, which is what a government account funding factions on a deficit needs. List the account in Config.API.overdraft with the furthest its balance may fall, written as a positive number, or true for no limit. Key it by the shared account name or by the job name.

Lua
Config.API = {    overdraft = {        ['society_government'] = 250000, -- may fall to -250,000        ['police']             = 50000,  -- job name works too        ['society_ambulance']  = true,   -- no limit    }}

An account not listed there keeps the hard floor at zero. A debit that is permitted but goes past the configured floor returns OVERDRAFT_LIMIT_EXCEEDED.

Player accounts and personal, business and savings accounts are never taken negative, and no setting changes that.

Money-moving exports return a table. On success it carries the new balance and a transaction id. On failure it carries an error code and a readable message, and no money moved.

Lua
{ success = true,  balance = 12500.00, txId = 'TX_1756400000_4821' }{ success = false, error = 'INSUFFICIENT_FUNDS', message = 'Insufficient funds for this transaction' }

Common error codes: ACCOUNT_NOT_FOUND, PLAYER_NOT_FOUND, INVALID_ACCOUNT_REF, INVALID_AMOUNT, INSUFFICIENT_FUNDS, ACCOUNT_FROZEN, ACCOUNT_INACTIVE, CANNOT_TRANSFER_TO_SELF, SOCIETY_NOT_FOUND, SOCIETY_BACKEND_MISSING, OVERDRAFT_LIMIT_EXCEEDED, OVERDRAFT_UNSUPPORTED.

exports.nx_realbanking:GetBalanceserver

Read the current balance of any account.

Parameters

ref string|number|table
Account reference.

Returns

number|nil
Lua
local balance = exports.nx_realbanking:GetBalance('society:police')local personal = exports.nx_realbanking:GetBalance('citizen:ABC123')
exports.nx_realbanking:AddMoneyserver

Credit an account. The reason is stored on the transaction and shown in the player's bank app.

Parameters

ref string|number|table
Account reference.
amount number
Positive amount. Rounded to two decimals.
reason string|nil
Stored on the transaction. Trimmed to 140 characters.
metadata table|nil
Extra data kept alongside the reason. On a company account, log = true also writes a row to its history (see Company history rows).

Returns

table { success, balance, txId, societyTxId?, accountId, error, message }
Lua
-- Fuel station revenue into a society accountlocal result = exports.nx_realbanking:AddMoney(    'society:mechanic', 1250.00, 'Fuel station revenue')if not result.success then    print('Payout failed: ' .. result.error)end
exports.nx_realbanking:RemoveMoneyserver

Debit an account. Stops at zero unless the account is listed in Config.API.overdraft.

Parameters

ref string|number|table
Account reference.
amount number
Positive amount. Rounded to two decimals.
reason string|nil
Stored on the transaction.
metadata table|nil
Extra data kept alongside the reason. On a company account, log = true also writes a row to its history (see Company history rows).

Returns

table { success, balance, txId, societyTxId?, accountId, error, message }
Lua
local result = exports.nx_realbanking:RemoveMoney(    'citizen:ABC123', 150.00, 'Union dues')-- An insurance premium the company's employees can see in its historyexports.nx_realbanking:RemoveMoney('society:rockfordautos', 1388, 'Vehicle insurance 07SBS151', {    log = true,                -- write a row to the company's history    actorCitizenId = 'ABC123', -- optional: who triggered it    actorName = 'Insurance',   -- optional: shown as who made it (default: your resource name)})
exports.nx_realbanking:Transferserver

Move money between any two accounts, in any combination. Debits the source first and puts the money back if the credit fails.

Parameters

fromRef string|number|table
Source account reference.
toRef string|number|table
Target account reference.
amount number
Positive amount.
reason string|nil
Stored on both sides of the transfer.
metadata table|nil
Extra data kept alongside the reason. On a company account, log = true also writes a row to its history (see Company history rows).

Returns

table { success, fromBalance, toBalance, txId, societyTxIds?, error, message }
Lua
-- Monthly funding from the government to a factionlocal result = exports.nx_realbanking:Transfer(    'gov', 'society:ambulance', 50000.00, 'Q3 department funding')-- Faction payroll to an individual, online or notexports.nx_realbanking:Transfer(    'society:police', 'citizen:ABC123', 2500.00, 'Weekly salary')
exports.nx_realbanking:CanAffordserver

Check whether an account holds at least the given amount.

Parameters

ref string|number|table
Account reference.
amount number
Amount to test against.

Returns

boolean
Lua
if exports.nx_realbanking:CanAfford('society:police', payrollTotal) then    runPayroll()end
exports.nx_realbanking:GetAccountserver

Read one account's details, including its live balance and whether the owner is online.

Parameters

ref string|number|table
Account reference.

Returns

table|nil { kind, accountId, accountNumber, citizenId, society, name, accountType, balance, frozen, active, online, source }
Lua
local account = exports.nx_realbanking:GetAccount('ACC123456789')if account and not account.frozen then    print(account.name, account.balance)end

accountNumber is the number a player sees for the account: the account id for a personal, business or savings account, and the company's account number for a society. It is nil for the government account, for a society looked up by its shared account name ('society_police'), and for a society that has not been given a number yet. Use GetSocietyAccountNumber when you need it for certain.

exports.nx_realbanking:GetAccountsserver

List every nx_realbanking account a player owns. The one linked to their framework bank balance is flagged and reports the live value rather than a cached copy.

Parameters

ref string|number|table
Reference to a player.

Returns

table Array of { accountId, accountType, name, balance, linked, frozen, active }
Lua
for _, account in ipairs(exports.nx_realbanking:GetAccounts('citizen:ABC123')) do    print(account.accountId, account.accountType, account.balance)end
exports.nx_realbanking:GetTransactionsserver

Read recent transactions for an account, newest first, with the stored reason attached as description.

Parameters

ref string|number|table
Account reference.
limit number|nil
Defaults to 20. Capped at 100.

Returns

table Array of transaction rows
Lua
local rows = exports.nx_realbanking:GetTransactions('ACC123456789', 10)for _, tx in ipairs(rows) do    print(tx.transaction_type, tx.amount, tx.description)end
exports.nx_realbanking:ResolveAccountserver

Resolve a reference without moving money. Use it on resource start to check that the account names in your own config are real.

Parameters

ref string|number|table
Account reference.

Returns

table { success, kind, accountId, accountNumber, citizenId, society, name, online, source, error, message }
Lua
local resolved = exports.nx_realbanking:ResolveAccount('society:fuel')if not resolved.success then    print('Configured account is not usable: ' .. resolved.error)else    print(resolved.kind, resolved.name)  -- "society", "Fuel"end

Invoices#

exports.nx_realbanking:CreateInvoiceserver

Insert a new invoice into the database and return its reference id.

Parameters

data table
Invoice payload. Required: senderIdentifier, receiverIdentifier (or receiverCompany), amount, label. Optional: senderName, receiverName, receiverCompany (a Config.Societies job: the invoice goes to that company, the same as receiverIdentifier = "society:<job>" or the account number of that company), type ("society" | "freelance" | "personal", default "personal"), senderJob, senderJobLabel, govAccount, societyAccount, dueDays (days from now) or dueAt (epoch seconds or ms, or "YYYY-MM-DD"), inside Config.InvoiceDue (a society invoice uses its society's range).

Returns

boolean success, string refIdOrError, number|nil dueAt (epoch ms)
Lua
local ok, refId = exports.nx_realbanking:CreateInvoice({    senderIdentifier = 'char1:abc',    senderName = 'John Smith',    receiverIdentifier = 'char1:xyz',    receiverName = 'Jane Doe',    type = 'personal',    amount = 250.00,    label = 'Ride share'})-- To a company: paid from its society account by a boss or another allowed gradelocal ok, refId = exports.nx_realbanking:CreateInvoice({    senderIdentifier = 'char1:abc',    senderName = 'Wholesale Parts',    receiverCompany = 'mechanic',    amount = 1200,    label = 'Tyre order #1042'})-- A society bill due in 60 days (needs Config.InvoiceDue.societies.realestate.maxDays >= 60)local ok, refId, dueAt = exports.nx_realbanking:CreateInvoice({    senderIdentifier = 'char1:abc',    senderName = 'Dynasty 8',    senderJob = 'realestate',    type = 'society',    societyAccount = 'society_realestate',    receiverIdentifier = 'char1:xyz',    amount = 25000,    label = 'Deposit, 12 Grove St',    dueDays = 60})

The receiver is told in game and, when nx_phone runs, on the phone. A company invoice notifies every online member who may pay it. Without dueDays or dueAt the invoice falls due after Config.InvoiceLimits.expiration.days. A date outside Config.InvoiceDue is clamped, or refused with DUE_OUT_OF_RANGE when outOfRange = 'reject'. Overdue handling and autopay read the stored date, so they work the same for every due date. Errors include COMPANY_NOT_FOUND, COMPANY_INVOICES_DISABLED, INVALID_AMOUNT, AMOUNT_TOO_LARGE, DUE_OUT_OF_RANGE and INVALID_DUE_DATE.

exports.nx_realbanking:GetInvoiceserver

Look up an invoice by numeric id or reference id.

Parameters

invoiceRef string|number
Numeric invoice id or reference id (e.g. "INV-ABC123").

Returns

table|nil
Lua
local invoice = exports.nx_realbanking:GetInvoice('INV-ABC123')
exports.nx_realbanking:GetInvoiceByRefserver

Fetch a single invoice row by its reference id.

Parameters

refId string
Reference id returned from CreateInvoice.

Returns

table|nil
Lua
local invoice = exports.nx_realbanking:GetInvoiceByRef('INV-ABC123')if invoice then    print(invoice.amount, invoice.status)end
exports.nx_realbanking:GetPlayerInvoicesserver

List invoices received by a given player, newest first.

Parameters

identifier string
Player identifier (framework-specific: ESX identifier or QB citizenid).
status? string
Filter: 'pending' | 'paid' | 'cancelled' | 'overdue'. Omit for all.

Returns

table[]
Lua
local pending = exports.nx_realbanking:GetPlayerInvoices('char1:abc', 'pending')print(('%d pending invoice(s)'):format(#pending))
exports.nx_realbanking:GetSentInvoicesserver

List invoices a player has sent.

Parameters

identifier string
Player identifier of the sender.
status? string
Filter: 'pending' | 'paid' | 'cancelled' | 'overdue'. Omit for all.

Returns

table[]
Lua
local sent = exports.nx_realbanking:GetSentInvoices('char1:abc', 'pending')
exports.nx_realbanking:GetSocietyInvoicesserver

List invoices issued under a given society or job.

Parameters

job string
Job name (matches Config.Societies key).
status? string
Filter: 'pending' | 'paid' | 'cancelled' | 'overdue'. Omit for all.

Returns

table[]
Lua
local policeInvoices = exports.nx_realbanking:GetSocietyInvoices('police', 'pending')
exports.nx_realbanking:PayInvoiceserver

Pay an invoice on behalf of the given source. Funds are pulled from the player's default account and distributed to society / commission / VAT destinations. A company invoice is paid from the company's society account instead, and the source must be allowed to pay for that company.

Parameters

refId string
Reference id of the invoice to pay.
source number
Server id of the paying player.

Returns

boolean success, string|nil error (e.g. 'NOT_RECEIVER', 'NO_COMPANY_PAY_PERMISSION', 'COMPANY_INSUFFICIENT_FUNDS', 'INVOICE_NOT_PAYABLE')
Lua
local ok, err = exports.nx_realbanking:PayInvoice('INV-ABC123', source)if not ok then    print('Payment failed:', err)end
exports.nx_realbanking:CancelInvoiceserver

Cancel a pending invoice. Bypasses the player-level cancel checks. Intended for admin or system flows.

Parameters

refId string
Reference id of the invoice to cancel.
reason? string
Optional reason recorded in the audit log.

Returns

boolean success, string|nil error
Lua
local ok, err = exports.nx_realbanking:CancelInvoice('INV-ABC123', 'duplicate')
exports.nx_realbanking:GetPendingInvoiceCountserver

Count a player's pending invoices in either direction.

Parameters

identifier string
Player identifier.
direction? 'received' | 'sent'
Direction to count. Defaults to 'received'.

Returns

number
Lua
local count = exports.nx_realbanking:GetPendingInvoiceCount('char1:abc', 'received')
exports.nx_realbanking:GetBillingRightsserver

What a player may bill right now: personal invoices, invoices as their own company, and which companies they may send invoices to. Use it in your own billing menu to show only the options the bank would accept.

Parameters

source number
Server id of the player.

Returns

table { personal, society, company, societyJob?, societyLabel?, companies = { { job, label } }, due, societyDue? }
Lua
local rights = exports.nx_realbanking:GetBillingRights(source)if rights.society then    print('Can bill as', rights.societyLabel)  -- rights.societyJob = 'mechanic'endfor _, company in ipairs(rights.companies) do    print('Can invoice', company.label, company.job)end
  • due is the due-date range when billing as themselves and societyDue the range when billing as their society, each { minDays, maxDays, defaultDays } from Config.InvoiceDue. Offer only those days in your menu.
  • personal is true when player-to-player invoices are switched on (Config.Invoices.enablePersonal and Config.FreelanceBilling.enabled).
  • society is true when the player's job is in Config.Societies with canBill = true and society invoices are on. societyJob and societyLabel are only set then.
  • companies lists every society the player may address an invoice to, sorted by label. Their own employer is never in it, and Custom.CanInvoiceCompany can remove more. company is true when the list is not empty.

An unknown or offline player gets every flag false and an empty list. Amount limits, daily limits and cooldowns are not part of the answer; they are still checked when the invoice is sent.

Company invoices#

An invoice addressed to a company has receiver_identifier = 'society:<job>' and the society label as receiver_name. It never appears in GetPlayerInvoices. Who may pay one is set in Configuration. An invoice sent to a company's account number is stored the same way.

exports.nx_realbanking:GetCompanyInvoicesserver

List invoices addressed to a company, newest first (up to 100).

Parameters

job string
Job name (a Config.Societies key).
status? string
Filter: 'pending' | 'paid' | 'cancelled' | 'overdue'. Omit for all.

Returns

table[] (empty for an unknown company)
Lua
local open = exports.nx_realbanking:GetCompanyInvoices('mechanic', 'pending')
exports.nx_realbanking:CanPayCompanyInvoicesserver

Whether a player may pay invoices addressed to a company, and use its society account. The answer comes from Custom.CanUseSocietyFunds in bridge/server.lua.

Parameters

source number
Server id of the player.
job? string
Company job name. Defaults to the player's current job.

Returns

boolean
Lua
if exports.nx_realbanking:CanPayCompanyInvoices(source) then    -- show the company's billsend
exports.nx_realbanking:DeclineCompanyInvoiceserver

Decline a pending company invoice as the given player, who must be allowed to pay for that company. The invoice is cancelled and the sender is told. Only works with Config.Invoices.allowDecline on; it is off by default.

Parameters

refId string
Reference id of the invoice.
source number
Server id of the declining player.

Returns

boolean success, string|nil error ('INVOICE_DECLINE_DISABLED' | 'INVOICE_NOT_FOUND' | 'PLAYER_NOT_FOUND' | 'NO_COMPANY_PAY_PERMISSION' | 'INVOICE_NOT_PENDING' | ...)
Lua
local ok, err = exports.nx_realbanking:DeclineCompanyInvoice('INV-ABC123', source)

Fines#

A fine is a bill issued by an agency, such as a police ticket. The player sees it in the bank app and pays it like any other invoice. It differs from a society invoice in a few ways:

  • No VAT, no commission and no acceptance step.
  • The whole amount goes to the job's society account from Config.Societies, or to the government account when the job has none.
  • Players cannot create or cancel one, and it stays payable after its due date. Autopay collects overdue fines when Config.Fines.autopay is on.

Only the resources listed in Config.Fines.allowedResources may call these three exports. Any other caller gets false, 'not_allowed'. All three return false, 'fines_unavailable' when Config.Fines.enabled is off or the database could not be prepared for fines (see Installation).

exports.nx_realbanking:CreateFineserver

Issue a fine to a player, online or offline.

Parameters

data table
Required: receiverIdentifier (framework identifier or citizenid), amount (1 to Config.Fines.maxAmount, rounded to cents), label. Optional: job (the agency, a Config.Societies key; omit for the government), agencyLabel (shown as the sender, default the society label), receiverName (looked up when omitted), dueDays (default Config.Fines.dueDays, capped at maxDueDays and at the job's Config.InvoiceDue.societies maxDays) or dueAt (epoch seconds or ms), externalRef (your own id for the fine, up to 64 characters).

Returns

string refId | false, string error
Lua
local refId, err = exports.nx_realbanking:CreateFine({    job = 'police',    agencyLabel = 'LSPD',    receiverIdentifier = identifier,    receiverName = 'John Doe',    amount = 250,    label = 'Speeding',    dueDays = 7,    externalRef = 'ticket:42'})if not refId then    print('Fine not issued: ' .. err)end

Errors: not_allowed, fines_unavailable, invalid_data, invalid_job, invalid_receiver, invalid_amount, invalid_label, create_failed.

Sending the same externalRef again while that fine is pending, overdue or paid returns the existing reference id, so a retried call never bills the player twice. The player is not notified by nx_realbanking unless Config.Fines.notifyReceiver is on; the issuing resource is expected to tell them.

exports.nx_realbanking:CancelFineserver

Cancel a fine that is pending or overdue.

Parameters

refId string
Reference id returned by CreateFine.
reason? string
Stored in the invoice log and the Discord log. Up to 140 characters.

Returns

true | false, string error ('not_allowed' | 'fines_unavailable' | 'not_found' | 'not_cancellable')
Lua
local ok, err = exports.nx_realbanking:CancelFine(refId, 'Issued in error')
exports.nx_realbanking:GetFineserver

Read one fine.

Parameters

refId string
Reference id returned by CreateFine.

Returns

table { refId, status, amount, job, agencyLabel, payee, receiverIdentifier, receiverName, label, externalRef?, paymentMethod?, createdAt?, dueAt?, paidAt? } | false, string error ('not_allowed' | 'fines_unavailable' | 'not_found')
Lua
local fine = exports.nx_realbanking:GetFine(refId)if fine and fine.status == 'paid' then    -- clear the ticket on your sideend

status is 'pending', 'paid', 'cancelled' or 'overdue'. payee is the society or government account the money goes to. The dates are Unix time in milliseconds and are left out when not set. To follow a fine without polling, listen to nx_realbanking:server:invoiceStateChanged.

Credit cards#

exports.nx_realbanking:ChargeCreditCardserver

Charge an amount against a credit card. Supply one of cardId, cardNumber, or citizenId to resolve the card.

Parameters

payload table
Fields: amount (number, required), cardId | cardNumber | citizenId (one required), merchant (string, optional), transactionType (string, optional).

Returns

table { success: boolean, error?: string, ... }
Lua
local result = exports.nx_realbanking:ChargeCreditCard({    citizenId = 'char1:abc',    amount = 1200,    merchant = 'Ammu-Nation',    transactionType = 'purchase'})if not result.success then    print('Charge failed:', result.error)end
exports.nx_realbanking:ApplyCreditCardserver

Run the credit-application flow for a player. Assesses score, checks tier eligibility, and either issues a card or returns a rejection reason.

Parameters

source number
Server id of the applying player.
requestedTier? string
One of 'standard', 'gold', 'black'. Omit to auto-assign the highest eligible tier from Config.Credit.tierPriority.

Returns

table { success: boolean, error?: string, card?: table, tier?: string, score?: number, ... }
Lua
local result = exports.nx_realbanking:ApplyCreditCard(source, 'gold')if result.success then    print('Issued', result.tier, 'card #', result.card.number)else    print('Rejected:', result.error)end

The Online* exports below mirror the bank UI actions with the ATM distance check removed, so another server resource such as a laptop or phone banking app can run them for a player who is nowhere near an ATM. Every other guard still runs: rate limiting, account access, ownership, status, and balance validation. These are server-only, so a client cannot reach them directly. Pass the player's own source, and call them only once your resource has authenticated that player's session.

Each returns a table shaped { success = boolean, error = string|nil } plus whatever fields the underlying action produces.

Remote banking#

exports.nx_realbanking:OnlineTransferserver

Move money between two accounts without requiring ATM proximity.

Parameters

source number
Server id of the player making the transfer.
data table
Fields: fromAccountId (or fromAccount), toAccountId (or toAccount), amount (number). Optional: description (string), stored on both transactions and shown in the bank app history.

Returns

table { success: boolean, error?: string, ... }
Lua
local result = exports.nx_realbanking:OnlineTransfer(source, {    fromAccountId = 'ACC-1001',    toAccountId = 'ACC-2002',    amount = 500.00,    description = 'Rent'})

Either side may be a company's account number (or society:<job>). Any player may pay into a company. Sending from a company account needs the same right as using it in the bank app (Custom.CanUseSocietyFunds), otherwise the result is ACCOUNT_ACCESS_DENIED. A transfer that touches a company account carries no fee, and a player who may not use the company account is never told its balance: toBalance is left out for them. With Config.SocietyAccounts.enabled off these transfers return SOCIETY_ACCOUNTS_DISABLED, and with Config.SocietyAccounts.transfer off they return ACCOUNT_ACCESS_DENIED in both directions.

exports.nx_realbanking:OnlineCreateAccountserver

Open a new account for the calling player without requiring ATM proximity.

Parameters

source number
Server id of the player opening the account.
data table
Fields: accountType ('personal' | 'business' | 'savings'), pin (4-digit numeric string). Optional: accountName (string).

Returns

table { success: boolean, error?: string, ... }
Lua
local result = exports.nx_realbanking:OnlineCreateAccount(source, {    accountType = 'savings',    accountName = 'Rainy day',    pin = '4821'})
exports.nx_realbanking:OnlineCloseAccountserver

Close an account the calling player owns, without requiring ATM proximity. The balance must be zero. The personal account linked to the framework bank balance cannot be closed and returns ACCOUNT_LINKED.

Parameters

source number
Server id of the requesting player.
data table
Fields: accountId (string).

Returns

table { success: boolean, error?: string, ... }
Lua
local result = exports.nx_realbanking:OnlineCloseAccount(source, {    accountId = 'ACC-1001'})
exports.nx_realbanking:OnlineAddMemberserver

Add a member to a shared account without requiring ATM proximity.

Parameters

source number
Server id of the account owner or manager.
data table
Fields: accountId (string), and citizenId (string) or targetSource (number) to identify the new member. Optional: role (string), permissions (table), limits (table).

Returns

table { success: boolean, error?: string, ... }
Lua
local result = exports.nx_realbanking:OnlineAddMember(source, {    accountId = 'ACC-1001',    citizenId = 'char1:xyz',    role = 'teller'})
exports.nx_realbanking:OnlineRemoveMemberserver

Remove a member from a shared account. The member does not have to be online, which covers the usual case of firing someone. Accepts a data table like the other Online exports, or the account id and citizen id as two plain arguments.

Parameters

source number
Server id of a player with member management rights on the account, or of the member removing themselves.
data table|string
Fields: accountId (string), and citizenId (string) or targetSource (number) to identify the member. Alternatively pass the account id here as a string.
citizenId? string
The member to remove, when data is the account id.

Returns

table { success: boolean, error?: string }
Lua
-- Fired by the boss, employee offlinelocal result = exports.nx_realbanking:OnlineRemoveMember(bossSource, accountId, citizenid)-- The employee quit: they remove themselves, no manager needs to be onlineexports.nx_realbanking:OnlineRemoveMember(source, {    accountId = 'ACC-1001',    citizenId = 'char1:xyz'})

The account owner cannot be removed. Besides the common codes, it returns MEMBER_NOT_FOUND when that citizen is not a member of the account and ACCOUNT_PERMISSION_DENIED when the caller may not manage members.

exports.nx_realbanking:OnlineTransferOwnershipserver

Hand ownership of an account to another citizen, without requiring ATM proximity.

Parameters

source number
Server id of the current owner.
data table
Fields: accountId (string), citizenId (string) of the new owner.

Returns

table { success: boolean, error?: string, ... }
Lua
local result = exports.nx_realbanking:OnlineTransferOwnership(source, {    accountId = 'ACC-1001',    citizenId = 'char1:xyz'})
exports.nx_realbanking:OnlineApplyCreditCardserver

Rate-limited credit application without ATM proximity. Use this instead of ApplyCreditCard when the caller is a remote banking surface.

Parameters

source number
Server id of the applying player.
data table
Optional. Field: requestedTier ('standard' | 'gold' | 'black'). Omit to auto-assign the highest eligible tier.

Returns

table { success: boolean, error?: string, card?: table, tier?: string, score?: number, ... }
Lua
local result = exports.nx_realbanking:OnlineApplyCreditCard(source, {    requestedTier = 'gold'})

Phone payments#

These back a phone's wallet and card terminal: nx_phone's Wallet and Tap to Pay use them, and any other phone resource can call them the same way. They are server-only. Every one that acts for a player takes that player's own source, is rate limited, and works out the player's job and account access itself, never from what the caller passes.

All of them return a table. A failure is { success = false, error = CODE }, and RATE_LIMIT_EXCEEDED also carries retryAfter in seconds.

exports.nx_realbanking:QuoteTransferFeeserver

What a transfer would cost, before the player confirms it. Runs the same account and access checks as a real transfer. Nothing moves and nothing is written.

Parameters

source number
Server id of the sending player.
data table
Fields: fromAccountId, toAccountId (strings), amount (number).

Returns

table { success, fee, total, sameOwner, insufficient }
Lua
local quote = exports.nx_realbanking:QuoteTransferFee(source, {    fromAccountId = 'ACC_1756400000_4821',    toAccountId = 'ACC_1756400000_7310',    amount = 500})if quote.success and not quote.insufficient then    print(('Fee %.2f, total %.2f'):format(quote.fee, quote.total))end

total is the amount plus the fee. sameOwner is true between two accounts of the same player (where Config.Fees.transfer.sameBankFree waives the fee). fromAccountId may be a company's account number, for a player allowed to use it; a company transfer carries no fee. Errors include INVALID_DATA, INVALID_AMOUNT, SOURCE_ACCOUNT_NOT_FOUND, TARGET_ACCOUNT_NOT_FOUND, ACCOUNT_ACCESS_DENIED and CANNOT_TRANSFER_TO_SELF.

exports.nx_realbanking:GetTerminalSocietyserver

The company a player may take card payments for: their own job, when it is in Config.Societies with canBill = true and society invoices are on.

Parameters

source number
Server id of the cashier.

Returns

table { success, job, label, requireReason, isBoss, grade }
Lua
local society = exports.nx_realbanking:GetTerminalSociety(source)if not society.success then    return -- 'NOT_BILLING': this player cannot take paymentsend
exports.nx_realbanking:QuoteTerminalserver

What a card payment of a given amount costs the customer, VAT included. No player is involved.

Parameters

job string
The billing company (a Config.Societies key with canBill = true).
amount number
Whole dollars, inside Config.InvoiceLimits.minAmount and maxAmount.

Returns

table { success, amount, vat, total }
Lua
local quote = exports.nx_realbanking:QuoteTerminal('mechanic', 450)-- with Config.VAT on at 10%: { success = true, amount = 450, vat = 45, total = 495 }

Errors: NOT_BILLING, INVALID_AMOUNT.

exports.nx_realbanking:PayTerminalserver

The customer pays a card payment from one of their own accounts. It is recorded as a society invoice that is created and paid in one step: VAT, commission, the company's share, the invoice history and the Discord log all work as they do for an invoice.

Parameters

source number
Server id of the paying customer.
data table
Required: job (the billing company), amount (whole dollars), accountId (an account the customer may transfer from), expectedTotal (the total you showed the customer, from QuoteTerminal), cashierIdentifier (framework identifier of the cashier, who receives the commission). Optional: label (up to 40 characters), reference (your own id, up to 40 characters), cashierName.

Returns

table { success, refId, amount, vat, total, balance }
Lua
local quote = exports.nx_realbanking:QuoteTerminal('mechanic', 450)local result = exports.nx_realbanking:PayTerminal(customerSource, {    job = 'mechanic',    amount = 450,    label = 'Brake pads',    accountId = customerAccountId,    expectedTotal = quote.total,    cashierIdentifier = cashierIdentifier,    cashierName = 'Sam Hayes'})

balance is the customer's balance after paying. If the price changed since the quote, the result is TOTAL_CHANGED and nothing is charged. Other errors include NOT_BILLING, INVALID_AMOUNT, INVALID_DATA, SELF_PAYMENT (the cashier cannot pay their own terminal), ACCOUNT_ACCESS_DENIED, ACCOUNT_CLOSED, INSUFFICIENT_FUNDS and PAYMENT_FAILED.

exports.nx_realbanking:RefundTerminalserver

Give a card payment back, once. The caller must be able to bill for the company that took the payment.

Parameters

source number
Server id of a player in the company that took the payment.
data table
Fields: refId (reference id of the payment). Optional: reason (up to 40 characters).

Returns

table { success, refId, amount, commission, partial? }
Lua
local result = exports.nx_realbanking:RefundTerminal(source, {    refId = 'INV-ABC123',    reason = 'Wrong item'})

The company pays back what it kept plus the VAT, and the commission is taken back from the cashier's bank. amount is what reached the customer and commission is what was recovered from the cashier. When the commission cannot be recovered, the customer gets the rest and partial is true. The money goes back to the account it was paid from. The invoice stays paid; its history shows the refund.

Errors: INVOICE_NOT_FOUND, NOT_BILLING, NOT_REFUNDABLE (not a society invoice paid from a bank account), ALREADY_REFUNDED, REFUND_IN_PROGRESS, SOCIETY_UNAVAILABLE, COMMISSION_UNRECOVERABLE, PAYMENT_FAILED. On PAYMENT_FAILED everything taken is put back. If the call raises a Lua error instead of returning, the outcome is unknown: do not retry it automatically.

Societies#

Societies are the job accounts behind job invoices, inspections and society:<job> references. They come from Config.Societies; these exports add more while the server runs, so a company created mid-session works at once with no restart. Every client is updated straight away, and players who join later get them on load.

Added societies are kept in memory. Register them again from the nx_realbanking:societiesReady event, which fires every time nx_realbanking starts. The money stays in the framework's shared account (account), so nothing is created in the database.

exports.nx_realbanking:RegisterSocietyserver

Add a society, or update one added earlier. A society in Config.Societies always wins and is never overwritten.

Parameters

job string
Job name, letters, digits, _ and - only.
def table
Optional. Fields: label (default the job name), account (default 'society_<job>'), canBill (default false), canInspect (default false), requireReason (default true), finePresets (array of { label, amount }), payGrade (lowest grade that may pay invoices sent to this company; bosses always can).

Returns

boolean success, string|nil error ('INVALID_JOB' | 'INVALID_ACCOUNT' | 'SOCIETY_IN_CONFIG')
Lua
local ok, err = exports.nx_realbanking:RegisterSociety('mechanic', {    label = 'Hayes Autos',    canBill = true,    finePresets = { { label = 'Repair', amount = 500 } }})
exports.nx_realbanking:UnregisterSocietyserver

Remove a society added with RegisterSociety. Its money is not touched. Societies in Config.Societies cannot be removed.

Parameters

job string
Job name.

Returns

boolean success, string|nil error ('SOCIETY_IN_CONFIG' | 'SOCIETY_NOT_FOUND')
Lua
exports.nx_realbanking:UnregisterSociety('mechanic')
exports.nx_realbanking:GetSocietiesserver

Every society the bank knows right now, from the config and added at runtime.

Returns

table job → { label, account, canBill, canInspect, finePresets, requireReason, payGrade, runtime }
Lua
for job, society in pairs(exports.nx_realbanking:GetSocieties()) do    print(job, society.label, society.runtime)end

Company accounts#

A company's society money shows up in the bank app as an account of its own for the players allowed to use it (see Society accounts). Each company gets an account number in the same ACC_… shape as a personal account. It is created once per job, kept in the nx_realbanking_society_numbers table and never changes.

Anyone can pay a company by its number: from the bank app, the ATM, the laptop or OnlineTransfer. Taking money out of a company account needs the right that Custom.CanUseSocietyFunds grants, and a player who is not allowed to use the account never sees its balance. An invoice sent to a company's number bills that company.

exports.nx_realbanking:GetSocietyAccountNumberserver

The account number of a job's company account. Created the first time it is asked for.

Parameters

job string
Job name: letters, digits, _ and - only.

Returns

string number | false, string error ('SOCIETY_ACCOUNTS_DISABLED' | 'SOCIETY_NOT_FOUND')
Lua
local number, err = exports.nx_realbanking:GetSocietyAccountNumber('mechanic')if number then    print('Pay Hayes Autos at ' .. number) -- e.g. ACC_1762120000_4821end

The job name is not checked against Config.Societies, so a number can be created ahead of the society. SOCIETY_NOT_FOUND means the job name was not valid or the number could not be saved.

exports.nx_realbanking:GetSocietyByAccountNumberserver

The job behind a company account number. Also accepts society:<job> and returns the job part.

Parameters

number string
A company account number. Case does not matter.

Returns

string job | false, 'ACCOUNT_NOT_FOUND'
Lua
local job = exports.nx_realbanking:GetSocietyByAccountNumber(typedNumber)if job then    print(typedNumber .. ' belongs to ' .. job)end
exports.nx_realbanking:IsSocietyJobserver

Whether a job may have a company account at all. False for the jobs in Config.SocietyAccounts.ignoreJobs (by default unemployed) and for an empty job name. Case does not matter.

Parameters

job string
Job name.

Returns

boolean
Lua
if exports.nx_realbanking:IsSocietyJob(jobName) then    -- list this job as a companyend

Use it in a script that lists jobs as companies, so a player without a job never sees a company for "unemployed".

exports.nx_realbanking:GetSocietyAccountsserver

The company account a player may use, as the bank app lists it. Empty when they may not use one, when their job has no society account, or when Config.SocietyAccounts.enabled is off.

Parameters

source number
Server id of the player.

Returns

table Array of { account_id, account_name, account_type = 'society', balance, is_society = true, society_job, is_owner = false, is_active, is_frozen, member_role = 'society', member_permissions = { view, deposit, withdraw, transfer } }
Lua
for _, account in ipairs(exports.nx_realbanking:GetSocietyAccounts(source)) do    print(account.account_id, account.account_name, account.balance)end

The list holds at most one entry, for the player's current job. account_id is the company's account number. member_permissions follows the deposit, withdraw and transfer switches in Config.SocietyAccounts.

exports.nx_realbanking:GetSocietyTransactionsserver

Recent money movements on a company account made through the bank (deposits, withdrawals, transfers), newest first, for a player allowed to use the account.

Parameters

source number
Server id of the player asking.
accountRef string
The company's account number, or 'society:<job>'.
limit? number
Defaults to 20. Capped at 100.

Returns

table { success, transactions = { { tx_id, account_id, transaction_type, amount, fee, balance_after, related_account_id, description, created_at } }, error? }
Lua
local result = exports.nx_realbanking:GetSocietyTransactions(source, 'society:mechanic', 10)if result.success then    for _, tx in ipairs(result.transactions) do        print(tx.transaction_type, tx.amount, tx.description)    endend

transaction_type is 'deposit', 'withdrawal', 'transfer_in' or 'transfer_out'. description names the player who made the movement and the note they wrote. related_account_id is the other side of a transfer. Movements made by players (bank app, ATM, laptop and OnlineTransfer) are always listed. Money moved with the Integration API is listed when the call asked for it (see below); money other scripts move straight into the framework's society account is not, unless they log it with LogSocietyTransaction. Errors: ACCOUNT_NOT_FOUND (not a company account) and ACCOUNT_ACCESS_DENIED.

Company history rows#

Charges and payouts made by scripts (insurance premiums, dealership sales, payroll) can show up in the company's history in the bank app. Pass log = true in the metadata of AddMoney, RemoveMoney or Transfer:

metadata key
logtrue writes one row per company side of the movement. Without it nothing changes.
actorCitizenIdOptional. The citizen id of whoever triggered it.
actorNameOptional. Shown as who made it. Defaults to the name of your resource.

The row's description is the reason. AddMoney writes a deposit, RemoveMoney a withdrawal, and Transfer a transfer_out on a company source and a transfer_in on a company target, each with the balance after the move. txId is the row's id (societyTxId too, and on a transfer societyTxIds = { transfer_out, transfer_in }). It needs no player online and no source. Personal accounts in the same call are not affected, and a move that fails writes nothing.

exports.nx_realbanking:LogSocietyTransactionserver

Write a row to a company's history for money that moved some other way. Moves no money.

Parameters

job string
Job name, 'society:<job>' or the company's account number.
type string
'withdrawal' | 'deposit' | 'transfer_in' | 'transfer_out'
amount number
Positive amount. Rounded to two decimals.
description string|nil
Shown in the history. Trimmed to 140 characters.
actor table|nil
{ citizenId?, name? }. name defaults to your resource name.

Returns

table { success, txId, balance, error, message }
Lua
exports.nx_realbanking:LogSocietyTransaction('pdm', 'deposit', 42000, 'Sale: Adder', {    citizenId = 'ABC123', name = 'PDM sales'})

balance (and the row's balance after) is the company's balance when the row is written. Errors: SOCIETY_NOT_FOUND (unknown company or no society account), INVALID_TRANSACTION_TYPE, INVALID_AMOUNT, DATABASE_ERROR.

First PIN#

exports.nx_realbanking:SetInitialPinserver

Set the first PIN on a player's account from your own script, for example during character creation, so the player does not have to pick one at their first ATM visit. With no accountId it uses the player's main personal account and creates it if needed. It follows the same rules as setting a PIN at the bank and never replaces a PIN that is already set.

Parameters

source number
Server id of the player. They must be online.
pin string
4-digit PIN, as a string ('0420'). Weak PINs such as 1111 or 1234 are refused unless Config.Pincode allows them.
accountId string
Optional. Another account the player owns.

Returns

table { success: boolean, accountId: string, error?: string }
Lua
-- e.g. after your character-creation formlocal result = exports.nx_realbanking:SetInitialPin(source, '4826')if not result.success then    print('PIN not set: ' .. result.error)end

Errors: PLAYER_NOT_FOUND, NO_ACCOUNT_FOUND, INVALID_PIN_FORMAT, PIN_TOO_WEAK_REPEATED, PIN_TOO_WEAK_SEQUENTIAL, ACCOUNT_NOT_FOUND, ACCOUNT_ACCESS_DENIED (the player does not own the account) and PIN_ALREADY_EXISTS.

With Config.Pincode.enabled = false it sets nothing and answers { success = true, pinDisabled = true }, so your step just moves on.

exports.nx_realbanking:IsPinEnabledserver

Whether this server uses bank PINs at all (Config.Pincode.enabled). Skip your own PIN step when it answers false. Client scripts can read exports.nx_realbanking:GetFeatureFlags().pin.

Returns

boolean
Lua
if exports.nx_realbanking:IsPinEnabled() then    -- show your PIN stepend

Administration#

These take an account reference, like the Integration API, and run with no player checks at all. Gate them behind your own admin permission before exposing them in a menu or command. A player reference resolves to that player's main personal account.

exports.nx_realbanking:SetAccountFrozenserver

Freeze or unfreeze an account. A frozen account refuses every money movement, whether it comes from the ATM, the bank app or the Integration API.

Parameters

ref string|number|table
Account reference.
frozen boolean
true to freeze, false to unfreeze.

Returns

boolean success, string|nil error
Lua
local ok, err = exports.nx_realbanking:SetAccountFrozen('citizen:ABC123', true)if not ok then    print('Freeze failed: ' .. err)end
exports.nx_realbanking:AdminResetPinserver

Clear an account's PIN. If the owner is online, a wrong-PIN lockout is lifted too. The owner sets a new PIN at the next ATM visit, the same way a new account does, with no old PIN and no reset fee.

Parameters

ref string|number|table
Account reference.

Returns

boolean success, string|nil error
Lua
local ok = exports.nx_realbanking:AdminResetPin('ACC123456789')
exports.nx_realbanking:GetATMsserver

List the ATM locations from Config.ATMLocations, for a teleport or waypoint menu.

Returns

table Array of { id, label, coords = { x, y, z } }
Lua
for _, atm in ipairs(exports.nx_realbanking:GetATMs()) do    print(atm.id, atm.label, atm.coords.x, atm.coords.y, atm.coords.z)end

Freezes and PIN resets made through these exports are recorded in the security log.

The logging exports below let your own resource write into the same Discord channels the bank uses, so a shop purchase or a heist payout lands in the same audit trail as a withdrawal.

Logging#

exports.nx_realbanking:LogBankEventserver

Record an event in the bank's Discord log. Routing, formatting and delivery follow whatever the server owner configured for that category.

Parameters

entry table
Fields: event (string, snake_case key), category ('transactions' | 'security' | 'invoices' | 'credit' | 'accounts' | 'admin'), severity ('info' | 'success' | 'warning' | 'critical'). Identify the player with source, or citizenId when they are offline. Optional: playerName, headline, summary, digest, fields (array of { name, value, inline }), footer.

Returns

table { success: boolean, error?: string }
Lua
local result = exports.nx_realbanking:LogBankEvent({    event     = 'shop_purchase',    category  = 'transactions',    severity  = 'info',    source    = source,    headline  = 'Ammunation purchase',    summary   = 'Bought a weapon licence',    fields    = { { name = 'Merchant', value = 'Ammunation', inline = true } }})if not result.success then    print('Not logged:', result.error) -- e.g. CATEGORY_DISABLEDend

Text you pass is escaped before it reaches Discord, so a player name containing formatting or a link cannot forge content in the log.

Returns CATEGORY_DISABLED when the server owner has that category switched off or has set no webhook for it. That is a normal outcome, not an error to retry.

exports.nx_realbanking:GetLogStatusserver

Current delivery state, for an admin command or a health check.

Returns

table { queues: table[], disabled: string[] }
Lua
local status = exports.nx_realbanking:GetLogStatus()for _, q in ipairs(status.queues) do    print(('%s: %d waiting, %d dropped'):format(q.category, q.pending, q.dropped))end

disabled lists webhooks that Discord rejected, usually because the URL was deleted or its token regenerated. Those are switched off until the resource restarts and are reported in the server console.

Client#

exports.nx_realbanking:IsAtATMclient

Returns true while the player is within detection range of a known ATM prop.

Returns

boolean
Lua
if exports.nx_realbanking:IsAtATM() then    -- Custom interaction promptend
exports.nx_realbanking:GetNearestATMclient

Returns the current ATM context, or nil if none is in range.

Returns

{ entity: number, coords: vector3, distance: number, hash: number } | nil
Lua
local atm = exports.nx_realbanking:GetNearestATM()if atm and atm.distance < 1.5 then    print('Standing at ATM', atm.entity)end
exports.nx_realbanking:IsInteractingclient

Returns true while the ATM session is active (camera engaged, NUI open).

Returns

boolean
Lua
if exports.nx_realbanking:IsInteracting() then    -- Suppress your own UI while bankingend
exports.nx_realbanking:GetSessionclient

Returns the current client-side session descriptor, or nil when idle.

Returns

table | nil
Lua
local session = exports.nx_realbanking:GetSession()if session then    print('Session id:', session.id)end
exports.nx_realbanking:GetFeatureFlagsclient

Which bank features are switched on in shared/config.lua, so your own front end (a laptop or phone banking app) can hide what is off.

Returns

table { credit, creditAdvance, invoices, invoicesPersonal, invoicesSociety, invoicesCompany, targetBilling, sharedAccounts, vatBreakdown, invoiceDecline, societyAccounts }
Lua
local features = exports.nx_realbanking:GetFeatureFlags()if not features.credit then    -- hide your Credit tabend

Every value is a boolean.

FlagTrue when
creditConfig.Credit.enabled
creditAdvanceCredit is on and Config.Credit.atmCashAdvance.enabled
invoicesPersonal or society invoices are on
invoicesPersonalConfig.Invoices.enablePersonal and Config.FreelanceBilling.enabled are both on
invoicesSocietyConfig.Invoices.enableSociety
invoicesCompanyInvoices are on and Config.Invoices.company.enabled
targetBillingInvoices are on and Config.Invoices.targetMenuEnabled
sharedAccountsConfig.Accounts.Shared.enabled
vatBreakdownConfig.VAT.enabled and Config.VAT.showBreakdown
invoiceDeclineInvoices are on and Config.Invoices.allowDecline
societyAccountsConfig.SocietyAccounts.enabled

We are not affiliated with or endorsed by Rockstar North, Take-Two Interactive or other rights holders. FiveM is a copyright and registered trademark of Take-Two Interactive Software, Inc. Our checkout process is owned & operated by Tebex Limited, who handle product fulfilment, billing support and refunds.