Exports
Public exports registered by nx_realbanking, split into server and client.
All server exports live under exports.nx_realbanking:<Name>(). Client
exports use the same pattern inside a client-side script.
Server
exports.nx_realbanking:CreateInvoiceserverInsert a new invoice into the database and return its reference id.
Parameters
datatable— Invoice payload. Required: senderIdentifier, receiverIdentifier, amount, label. Optional: senderName, receiverName, type ("society" | "freelance" | "personal", default "personal"), senderJob, senderJobLabel, govAccount, societyAccount.
Returns
boolean success, string|nil refIdOrErrorlocal 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'
})exports.nx_realbanking:GetInvoiceserverLook up an invoice by numeric id or reference id.
Parameters
invoiceRefstring|number— Numeric invoice id or reference id (e.g. "INV-ABC123").
Returns
table|nillocal invoice = exports.nx_realbanking:GetInvoice('INV-ABC123')exports.nx_realbanking:GetInvoiceByRefserverFetch a single invoice row by its reference id.
Parameters
refIdstring— Reference id returned from CreateInvoice.
Returns
table|nillocal invoice = exports.nx_realbanking:GetInvoiceByRef('INV-ABC123')
if invoice then
print(invoice.amount, invoice.status)
endexports.nx_realbanking:GetPlayerInvoicesserverList invoices received by a given player, newest first.
Parameters
identifierstring— Player identifier (framework-specific: ESX identifier or QB citizenid).status?string— Filter: 'pending' | 'paid' | 'cancelled' | 'overdue'. Omit for all.
Returns
table[]local pending = exports.nx_realbanking:GetPlayerInvoices('char1:abc', 'pending')
print(('%d pending invoice(s)'):format(#pending))exports.nx_realbanking:GetSentInvoicesserverList invoices a player has sent.
Parameters
identifierstring— Player identifier of the sender.status?string— Filter: 'pending' | 'paid' | 'cancelled' | 'overdue'. Omit for all.
Returns
table[]local sent = exports.nx_realbanking:GetSentInvoices('char1:abc', 'pending')exports.nx_realbanking:GetSocietyInvoicesserverList invoices issued under a given society or job.
Parameters
jobstring— Job name (matches Config.Societies key).status?string— Filter: 'pending' | 'paid' | 'cancelled' | 'overdue'. Omit for all.
Returns
table[]local policeInvoices = exports.nx_realbanking:GetSocietyInvoices('police', 'pending')exports.nx_realbanking:PayInvoiceserverPay an invoice on behalf of the given source. Funds are pulled from the player's default account and distributed to society / commission / VAT destinations.
Parameters
refIdstring— Reference id of the invoice to pay.sourcenumber— Server id of the paying player.
Returns
boolean success, string|nil errorlocal ok, err = exports.nx_realbanking:PayInvoice('INV-ABC123', source)
if not ok then
print('Payment failed:', err)
endexports.nx_realbanking:CancelInvoiceserverCancel a pending invoice. Bypasses the player-level cancel checks. Intended for admin or system flows.
Parameters
refIdstring— Reference id of the invoice to cancel.reason?string— Optional reason recorded in the audit log.
Returns
boolean success, string|nil errorlocal ok, err = exports.nx_realbanking:CancelInvoice('INV-ABC123', 'duplicate')exports.nx_realbanking:GetPendingInvoiceCountserverCount a player's pending invoices in either direction.
Parameters
identifierstring— Player identifier.direction?'received' | 'sent'— Direction to count. Defaults to 'received'.
Returns
numberlocal count = exports.nx_realbanking:GetPendingInvoiceCount('char1:abc', 'received')exports.nx_realbanking:ChargeCreditCardserverCharge an amount against a credit card. Supply one of cardId, cardNumber, or citizenId to resolve the card.
Parameters
payloadtable— Fields: amount (number, required), cardId | cardNumber | citizenId (one required), merchant (string, optional), transactionType (string, optional).
Returns
table { success: boolean, error?: string, ... }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)
endexports.nx_realbanking:ApplyCreditCardserverRun the credit-application flow for a player. Assesses score, checks tier eligibility, and either issues a card or returns a rejection reason.
Parameters
sourcenumber— 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, ... }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)
endThe 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.
exports.nx_realbanking:OnlineTransferserverMove money between two accounts without requiring ATM proximity.
Parameters
sourcenumber— Server id of the player making the transfer.datatable— Fields: fromAccountId (or fromAccount), toAccountId (or toAccount), amount (number). Optional: description (string).
Returns
table { success: boolean, error?: string, ... }local result = exports.nx_realbanking:OnlineTransfer(source, {
fromAccountId = 'ACC-1001',
toAccountId = 'ACC-2002',
amount = 500.00,
description = 'Rent'
})exports.nx_realbanking:OnlineCreateAccountserverOpen a new account for the calling player without requiring ATM proximity.
Parameters
sourcenumber— Server id of the player opening the account.datatable— Fields: accountType ('personal' | 'business' | 'savings'), pin (4-digit numeric string). Optional: accountName (string).
Returns
table { success: boolean, error?: string, ... }local result = exports.nx_realbanking:OnlineCreateAccount(source, {
accountType = 'savings',
accountName = 'Rainy day',
pin = '4821'
})exports.nx_realbanking:OnlineCloseAccountserverClose an account the calling player owns, without requiring ATM proximity.
Parameters
sourcenumber— Server id of the requesting player.datatable— Fields: accountId (string).
Returns
table { success: boolean, error?: string, ... }local result = exports.nx_realbanking:OnlineCloseAccount(source, {
accountId = 'ACC-1001'
})exports.nx_realbanking:OnlineAddMemberserverAdd a member to a shared account without requiring ATM proximity.
Parameters
sourcenumber— Server id of the account owner or manager.datatable— 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, ... }local result = exports.nx_realbanking:OnlineAddMember(source, {
accountId = 'ACC-1001',
citizenId = 'char1:xyz',
role = 'teller'
})exports.nx_realbanking:OnlineTransferOwnershipserverHand ownership of an account to another citizen, without requiring ATM proximity.
Parameters
sourcenumber— Server id of the current owner.datatable— Fields: accountId (string), citizenId (string) of the new owner.
Returns
table { success: boolean, error?: string, ... }local result = exports.nx_realbanking:OnlineTransferOwnership(source, {
accountId = 'ACC-1001',
citizenId = 'char1:xyz'
})exports.nx_realbanking:OnlineApplyCreditCardserverRate-limited credit application without ATM proximity. Use this instead of ApplyCreditCard when the caller is a remote banking surface.
Parameters
sourcenumber— Server id of the applying player.datatable— 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, ... }local result = exports.nx_realbanking:OnlineApplyCreditCard(source, {
requestedTier = 'gold'
})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.
exports.nx_realbanking:LogBankEventserverRecord an event in the bank's Discord log. Routing, formatting and delivery follow whatever the server owner configured for that category.
Parameters
entrytable— 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 }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_DISABLED
endText 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:GetLogStatusserverCurrent delivery state, for an admin command or a health check.
Returns
table { queues: table[], disabled: string[] }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))
enddisabled 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:IsAtATMclientReturns true while the player is within detection range of a known ATM prop.
Returns
booleanif exports.nx_realbanking:IsAtATM() then
-- Custom interaction prompt
endexports.nx_realbanking:GetNearestATMclientReturns the current ATM context, or nil if none is in range.
Returns
{ entity: number, coords: vector3, distance: number, hash: number } | nillocal atm = exports.nx_realbanking:GetNearestATM()
if atm and atm.distance < 1.5 then
print('Standing at ATM', atm.entity)
endexports.nx_realbanking:IsInteractingclientReturns true while the ATM session is active (camera engaged, NUI open).
Returns
booleanif exports.nx_realbanking:IsInteracting() then
-- Suppress your own UI while banking
endexports.nx_realbanking:GetSessionclientReturns the current client-side session descriptor, or nil when idle.
Returns
table | nillocal session = exports.nx_realbanking:GetSession()
if session then
print('Session id:', session.id)
end