Installation ​
Requirements ​
- A recent FiveM server artifact (Lua 5.4)
- oxmysql, the only hard dependency
- Node 18+ to build the NUI once
Optional, auto-detected at start:
| Kind | Resources | Used for |
|---|---|---|
| Framework | qbx_core, qb-core, es_extended | Character id and name, cash and bank, jobs, grades and duty. Without one, np_payments runs standalone (see Bridges) |
| Banking | np_banking, Renewed-Banking, qb-banking or qb-management, okokBanking, esx_addonaccount | Shared, business and faction accounts. np_banking also brings savings, cards, PINs and its own limits. Without one, only cash and the framework bank |
| Inventory | ox_inventory, np_inventory, qb-inventory, ESX | Receipt items and bank cards from the inventory |
| HUD | np_hud | Toasts, boss approval toasts with Approve / Deny, hiding HUD zones under the sheet |
| Phone | np_phone | The Pay app, notifications without np_hud, invoices in the Wallet, contact names |
| Menu | np_menu | "Charge (terminal)" and "Give cash" on players |
| Characters | np_character | Character id and name in standalone mode |
| Staff | np_admin | Permissions, live settings and the Test payment staff action. Without it, a fallback decides who is staff |
Steps ​
- Put the resource in
resources/asnp_payments. The NUI callbacks usehttps://np_payments/…and other resources callexports.np_payments, so keep the name. - Build the NUI:shThis creates
cd web && npm ci && npm run buildweb/dist/index.html(checkout, terminal, quick pill, PIN pad) andweb/dist/phone.html(the np_phone app).web/distis not committed, so a fresh clone starts with a blank UI until you build it. - Database: with
Config.AutoCreateTables = true(the default) the 6 tables are created at start. Otherwise importsql/np_payments.sqlyourself. Existing installations automatically add the invoice idempotency key and caller-scope columns, then migrate the unique index to(idempotency_scope, idempotency_key)at startup. If that migration cannot be verified, keyed invoice creation fails closed until the schema is repaired. - Receipts: with ox_inventory or qb-inventory, add a
receiptitem. np_inventory registers it at runtime, so skip this step there.lua['receipt'] = { label = 'Receipt', weight = 5, stack = false, close = true }, - Add to
server.cfg. Start np_payments after the framework and the banking resource, and before the resources that charge through it:cfgThere are noensure oxmysql ensure qbx_core # or qb-core / es_extended ensure np_banking # optional, any supported banking resource works; after the inventory, see /np_banking/installation ensure np_hud # optional ensure np_phone # optional ensure np_admin # optional: permissions, settings, staff tools ensure np_payments ensure np_inventory # and every other resource that uses np_paymentsadd_acelines: staff get thenp_payments.adminnode in np_admin (see Permissions). - Configure
shared/config.lua(Configuration): your factions, businesses and terminal businesses at least.
Start order
np_payments picks its framework and banking bridge once, at start. Resources with Config.Payments = 'auto' check
whether np_payments is started when a purchase happens, so they also pick it up if it starts later.
Permissions ​
np_payments uses no ACE. Every check is a permission node, managed in np_admin: grant the
nodes to an np_admin group or a single player (wildcards like np_payments.* work, an explicit deny wins).
| Node | Grants |
|---|---|
np_payments.admin |
/paytest and the np_admin staff action Test payment (Resource tools). The server console is always allowed |
np_payments.job.<name>[.<grade>] |
Standalone only: member of job <name> (factions, businesses, terminals); the grade is the highest granted .<grade>. See Bridges → Standalone |
np_payments.boss.<name> |
Standalone only: boss of <name> (no limit, edits member rules, approves) |
Without np_admin running, only these pass a check:
- the server console;
- the identifiers in the convar
np_admin_fallback(set np_admin_fallback "license:abc…,discord:123…"); - on es_extended, the ESX groups in
np_admin_fallback_groups(defaultadmin,superadmin).
Everyone else is refused, including the standalone job and boss nodes. See Concepts → Permissions.
Tables ​
| Table | Holds |
|---|---|
np_payments_payments |
The ledger: one row per settled payment with reference, merchant, amount, tip, tax, method, split parts, payee, items and refunds |
np_payments_defaults |
Default method per character and category (Pay app) |
np_payments_settings |
Player settings: streamer mode, auto-pay categories, last used method |
np_payments_rules |
Member rules for business and faction accounts |
np_payments_spend |
Daily spend per member and account |
np_payments_invoices |
Invoices, instalments and QR codes, with a caller-scoped optional idempotency key |
Check it works ​
- Join with an account that has
np_payments.admin(or is in the fallback) and run/paytest. The Rob's Liquor sample sheet ($95) opens. /paytest quickshows the parking pill,/paytest split,/paytest laterand/paytest terminalshow the other flows. See Events & commands.- The server console prints the result, for example
[np_payments] /paytest checkout -> {"ok":true,"ref":"PX-20481",…}.
Troubleshooting ​
| Problem | Fix |
|---|---|
| Blank sheet, nothing visible | Build the NUI (web/dist missing) |
| Only Cash and Bank in the list | No banking resource with job accounts is running, or the player's job is not in Config.Factions, Config.Businesses or Config.Terminal.businesses |
| The sheet opens behind another UI | Raise Config.ZIndex (default 1000) |
| No receipt in the inventory | Add the receipt item (ox / qb), or set Config.Receipt.enabled = false |
/paytest says no permission |
Grant the np_payments.admin node in np_admin (without np_admin: add your identifier to np_admin_fallback, or use an ESX group from np_admin_fallback_groups), or set Config.Debug = true |
| Standalone: a player has no job account | Grant np_payments.job.<name> (and .<grade> / np_payments.boss.<name>) in np_admin. add_ace lines are no longer read |
| "No boss online to approve" | No player of that job with grade Config.Rules.bossGrade or higher (or isboss) is online |
| Bosses can't approve | Bosses decide in the np_hud toast or in the Pay app queue (np_phone). Without np_hud and np_phone they only get a chat line and the request declines after Config.Approvals.timeout |