NX CreativeNX CreativeDocs
ScriptsRealbanking

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:CreateInvoiceserver

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

Parameters

  • datatableInvoice payload. Required: senderIdentifier, senderName, receiverIdentifier, receiverName, amount. Optional: type ("society" | "freelance" | "personal"), senderJob, senderJobLabel, label, vatPercent, vatAmount, commissionPercent, commissionAmount, govAccount, societyAccount.

Returns

boolean success, string|nil refIdOrError
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'
})
exports.nx_realbanking:GetInvoiceByRefserver

Fetch a single invoice row by its reference id.

Parameters

  • refIdstringReference id returned from CreateInvoice.

Returns

table|nil
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

  • identifierstringPlayer identifier (framework-specific: ESX identifier or QB citizenid).
  • status?stringFilter: '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: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.

Parameters

  • refIdstringReference id of the invoice to pay.
  • sourcenumberServer id of the paying player.

Returns

boolean success, string|nil error
local ok, err = exports.nx_realbanking:PayInvoice('INV-ABC123', source)
if not ok then
    print('Payment failed:', err)
end
exports.nx_realbanking:ChargeCreditCardserver

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

Parameters

  • payloadtableFields: 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)
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

  • sourcenumberServer id of the applying player.
  • requestedTier?stringOne 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)
end

Client

exports.nx_realbanking:IsAtATMclient

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

Returns

boolean
if exports.nx_realbanking:IsAtATM() then
    -- Custom interaction prompt
end
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
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
if exports.nx_realbanking:IsInteracting() then
    -- Suppress your own UI while banking
end
exports.nx_realbanking:GetSessionclient

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

Returns

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

On this page