Exports & Developer API
Other scripts interact with finals_banking through server exports (Lua) and client exports (mainly ox_inventory item hooks). Call them only after finals_banking has started (e.g. ensure finals_banking
Player / loan identity (borrowerKey, storageKey)
| Framework | Value to pass |
|---|---|
| QB / QBX | citizenid (string) |
| ESX | identifier / users.identifier as used by this resource |
| ox_core | Character id as stored in banking tables (e.g. string charId) |
Offline helpers use the same storage key as online (QB citizenid, ESX identifier). ox_core does not support the offline bank money exports in developer_exports.lua (they return false / no-op).
Server — society / job accounts
Implemented in server/society/society_banking_exports.lua. Job name is normalized (e.g. lowercased). Society balance storage follows Config.SocietyBanking.jobBalanceStorage on QB/QBX; ESX uses finals_banking_esx_society; ox_core uses finals_banking_ox_society.
| Export | Arguments | Returns |
|---|---|---|
AddMoney | jobName, amount (int ≥ 1), reason (any, optional) | boolean |
RemoveMoney | jobName, amount (int ≥ 1), reason (any, optional) | boolean |
GetAccountBalance | jobName | number (balance, 0 if missing) |
GetBalance | jobName | same as GetAccountBalance |
CreateJobAccount | jobName, label (optional display label) | boolean |
GetAccount | jobName | { account_name, account_balance, money } (compat for older scripts) |
Example
exports['finals_banking']:AddMoney('banker', 5000, 'branch deposit')
local bal = exports['finals_banking']:GetBalance('banker')Server — credit, loans, player bank (developer API)
Implemented in server/dev/developer_exports.lua.
| Export | Arguments | Returns / notes |
|---|---|---|
GetBankingFramework | — | Framework id string (e.g. 'ox', 'qb', 'esx_legacy', 'esx_finals_v1') or nil |
GetCreditProfile | borrowerKey | Row from finals_banking_credit or nil |
GetCreditScore | borrowerKey | number (defaults to config default if no row) |
EnsureCreditProfile | borrowerKey | boolean |
AdjustCreditScore | borrowerKey, delta (int) | boolean |
GetActiveLoansForBorrower | borrowerKey | array of { ... } loan rows (status = 'active') |
CountActiveLoans | borrowerKey | number |
IsLoanWithdrawLocked | borrowerKey, accountId (number) | boolean |
GetPlayerPrimaryAccountId | source (player id) | Primary UI account id or nil |
GetPlayerBankBalance | source, accountId (optional) | Bank balance or nil |
AddPlayerBankMoney | source, amount (int ≥ 1), reason (string, optional) | boolean |
RemovePlayerBankMoney | source, amount (int ≥ 1), reason (string, optional) | boolean |
AddOfflineBankMoney | storageKey, amount, reason | QB / ESX only — boolean |
RemoveOfflineBankMoney | storageKey, amount, reason | QB / ESX only — boolean |
GetPrimaryBankAccountIdFromCitizenId | storageKey | QB / ESX only — primary account id or nil |
Example
local fw = exports['finals_banking']:GetBankingFramework()
local ok = exports['finals_banking']:AddPlayerBankMoney(src, 500, 'paycheck')
local score = exports['finals_banking']:GetCreditScore(citizenid)Client — ox_inventory (item client.export)
Register these export names on items in ox_inventory (see installation.md and GitBook):
| Export | Typical item | Purpose |
|---|---|---|
useDebitCardItem | Config.DebitCard.item | Opens debit card preview UI |
useBankerTablet | BankerConfig.TabletItem | Opens banker tablet (loan officer) |
useLoanAgreementItem | BankerConfig.LoanAgreementItem | Opens loan agreement viewer |
Example
['bankcard_fleeca'] = {
client = { export = 'finals_banking.useDebitCardItem' },
},Notes
- Errors or
nilusually mean wrong framework, player not loaded, or invalidsource/ key. - For society behaviour (who can open the company tab), see
shared/config.lua→Config.SocietyBankingand framework job SQL examples undersql/ox/,sql/qb/,sql/esx/.