Skip to content

Bridges & banking providers ​

np_payments talks to three kinds of resources through bridges in bridge/. Each bridge file loads only when its resource is started and selected (Config.Framework, Config.Banking, Config.Inventory, 'auto' = the first started one). Detection runs once, at start, so start these resources before np_payments. Every call into another resource goes through pcall, so a missing export degrades a feature instead of breaking the checkout.

Framework ​

Bridge Resource Cid Jobs and duty
qbx qbx_core citizenid Job, grade, onduty, isboss
qb qb-core citizenid Job, grade, onduty, isboss
esx es_extended identifier Job, grade, job.onDuty when set (else on duty), boss = grade name boss
standalone none np_character character id, else the license From np_admin permission nodes (below)

Auto-detection order: qbx_core → qb-core → es_extended → standalone. Cash and the personal bank always come from the framework. With np_inventory in item mode, its money item stays in sync with framework cash by itself.

The bridges forward character load, unload and job changes, so an open checkout ends when a player switches character, and the register access follows the job.

Standalone ​

Without a framework, every character gets an in-memory wallet seeded from Config.StandaloneMoney ({ cash = 500, bank = 5000 }). It is lost on restart, so use a framework or np_banking for a real economy. With np_character running, its active character is the cid and its name is used.

Jobs come from np_admin permission nodes (no ACE), checked only for jobs np_payments knows (factions, businesses, terminals). Grant them to an np_admin group or a single player:

Node Means
np_payments.job.<name> Member of job <name>, grade 0, always on duty
np_payments.job.<name>.<grade> Grade <grade> (1–10; the highest granted one counts). Needs the base node too
np_payments.boss.<name> Boss of <name>: no limit, edits member rules, approves

For example np_payments.job.mechanic + np_payments.job.mechanic.2 = mechanic, grade 2. The base and boss nodes of every known job are registered in np_admin, so they show up in its permission matrix. Without np_admin running, only the fallback passes these checks, so standalone jobs effectively need np_admin.

Banking ​

The banking provider lists the accounts a player may use and moves the money. np_payments holds no money itself.

Provider Config.Banking Personal accounts Job accounts Cards & PIN
np_banking 'np_banking' Every account: checking (= the framework bank), personal, savings, shared Business, society, faction, government Yes, with its own member limits
Renewed-Banking 'renewed' Framework bank getAccountMoney / addAccountMoney / removeAccountMoney No
qb-banking / qb-management 'qb' Framework bank qb-banking job accounts, else qb-management No
okokBanking 'okok' Framework bank Society accounts (also tries society_<job>) No
esx_addonaccount 'esx' Framework bank society_<job> shared accounts No
Framework 'framework' Framework bank None No

Auto-detection takes the first one that is started in this order. Job accounts only show for jobs in Config.Factions, Config.Businesses or Config.Terminal.businesses.

np_banking provider contract ​

With np_banking, np_payments calls these exports (bridge/banking/server/1_np_banking.lua). Every call is pcall'd; a missing export falls back to the framework personal bank. Start np_banking before np_payments so the bridge is picked at start. If np_payments was already running (np_banking restarted), np_banking registers the same provider at runtime with RegisterProvider. The full export list is on np_banking → Exports.

Export Returns Used for
ListAccounts(src) Account[] (below), checking first The method list
GetAccount(id) { id, bank, type, label, number, owner, job, frozen, closed, balance } Balance refresh
Charge(id, amount, meta) true, tx | false, err Charging. err is a lower-case code ('funds', 'frozen', 'limit', 'not_allowed', 'card_frozen', 'pin_required', …). meta = { reason, actor = src, merchant, category, request, card?, contactless? }. np_banking checks the actor's role and daily member limit on personal and shared accounts and trusts np_payments on job accounts; meta.card checks the card's state, account, daily limit and contactless limit
Credit(id, amount, meta) true, tx | false, err Payee credit, refunds (meta.refund writes a refund row), split rollback
GetSocietyAccount(job) account id Payee { type = 'society' | 'business', id = job }. Created on first use
CreditCitizen(cid, amount, reason) boolean Refunds and commissions to offline players (their checking account)
GetCardForItem(metadata, src) { id, account, label, number, owner, holder, bank, tier, frozen, balance } Bank cards from the inventory (Config.Cards.items); metadata.card is the card id
IsCardFrozen(cardId) boolean When GetCardForItem returns no frozen (np_banking always returns it)
CheckPin(src, { account, card? }, pin) boolean PIN pad. Without card: the player's own card on that account. np_banking blocks the card after its own Config.Cards.maxTries
BlockCard(cardId, reason?) boolean 3 wrong PINs (reason defaults to 'pin')
GetAccountMembers(id) identifier[], owner first "X paid $Y" toasts for shared accounts

np_banking account types map to np_payments kinds: checking / personal → personal, savings → savings, shared → shared, business / society → business (faction when the job is in Config.Factions), faction / government → faction.

ListAccounts returns one entry per account the player can see:

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',
  balance = 48215,
  role = 'owner',        -- 'owner' | 'spend' | 'view'
  job = nil,             -- job of a job account
  frozen = false,
  pinRequired = false,   -- np_banking Config.Accounts.pinForBankCharges
  icon = 'building-columns', tint = 'red',
  limit = nil,           -- { used, max }: np_banking manages the member's daily limit, np_payments rules are skipped
}

Custom provider: RegisterProvider ​

Any banking resource can plug in at runtime. While Config.Banking is 'auto' (or the same name), the registered provider replaces the bridge provider. When the registering resource stops, np_payments goes back to the bridge provider.

lua
-- server, in your banking resource (start it after np_payments)
exports.np_payments:RegisterProvider('my_bank', {
  caps = { cards = false, pin = false },

  -- required
  accounts = function(src, ctx)            -- ctx = { cid, job, amount, category }
    return {
      { id = 'personal', kind = 'personal', label = 'Checking', balance = MyBank.balance(src), role = 'owner' },
    }
  end,
  charge = function(src, id, amount, reason, meta) -- -> ok, err ('funds', 'frozen', …)
    return MyBank.remove(src, id, amount, reason)
  end,
  credit = function(id, amount, reason, meta)      -- meta.src = player for personal accounts
    return MyBank.add(id, amount, reason, meta and meta.src)
  end,

  -- optional
  balance = function(id, src) return MyBank.balanceOf(id, src) end,
  society = function(job) return 'society:' .. job end,          -- payee { type = 'society', id = job }
  creditCid = function(cid, amount, reason) return MyBank.addOffline(cid, amount, reason) end,
  members = function(id) return MyBank.members(id) end,         -- { cid, … }
})
Field Required Description
accounts(src, ctx) Yes Account[]: { id, kind, label, sub?, number?, badge?, balance, icon?, tint?, role, job?, frozen?, needsPin?, limit? }. kind is 'personal', 'savings', 'shared', 'business' or 'faction'
charge(src, id, amount, reason, meta) Yes Take the money. ok, err
credit(id, amount, reason, meta) Yes Add money. ok, err
balance(id, src?) No Fresh balance
society(job) No Account id of a job's society account
creditCid(cid, amount, reason) No Refunds to offline players
card(src, item) No { account, label, number, owner, frozen } for a card item (caps.cards)
checkPin(src, target, pin) No target = { account, card? } (caps.pin)
block(src, target) No After 3 wrong PINs
members(id) No Shared account members for toasts
caps No { cards = bool, pin = bool }

RegisterProvider returns false when accounts, charge or credit is missing, or when Config.Banking names a different provider.

Inventory ​

Used for receipt items and bank cards.

Bridge Resource Receipts Cards
ox ox_inventory, np_inventory Yes, with metadata Yes (with np_banking)
qb qb-inventory (ps / lj forks) Yes, metadata as info Yes (with np_banking)
esx ESX default inventory Plain items, no metadata No
none none No No

np_inventory registers the receipt item at runtime. With ox_inventory or qb-inventory, add it to the item list yourself (Installation).

While the sheet is open np_payments locks np_inventory (setBusy), but only when the inventory isn't open: an open shop is often the caller, and locking would close it.

Other integrations ​

Resource What np_payments does with it
np_hud Toasts for every outcome, boss approval toasts with Approve / Deny, zone claims while the sheet (all) or the pill (bottom-center) is open. Re-claims after an np_hud restart
np_phone The Pay app, notifications without np_hud, invoices in the Wallet, contact names on the register and in the split
np_menu "Charge (terminal)" and "Give cash" context options on players
np_character Character id and name in standalone mode, character switch