Exports & Integration
Server and client exports for integrating with other resources.
This guide documents all available exports for integrating Oxide Banking with other resources.
Table of Contents
- Legacy Compatibility
- Account Management
- Money Operations
- Card Operations
- Loan Operations
- Credit Score
- Transaction Operations
- Business Operations
- Utility Functions
- Common Integration Examples
Legacy Compatibility
Oxide Banking provides full backwards compatibility with qb-banking. All original exports work without modification.
Using the Resource Name
You can use either resource name:
-- Both work identically:
exports['qb-banking']:AddMoney(accountName, amount, reason)
exports['oxide-banking']:AddMoney(accountName, amount, reason)
Account Management
CreatePlayerAccount
Create a shared account for a player.
exports['qb-banking']:CreatePlayerAccount(playerId, accountName, balance, users)
| Parameter | Type | Description |
|---|---|---|
| playerId | number | Server ID of the player |
| accountName | string | Unique account name |
| balance | number | Initial balance (optional, default 0) |
| users | table | Array of citizenids with access (optional) |
Example:
local playerId = source
exports['qb-banking']:CreatePlayerAccount(playerId, 'family-savings', 1000, {})
CreateJobAccount
Create a job/business account.
exports['qb-banking']:CreateJobAccount(accountName, balance)
| Parameter | Type | Description |
|---|---|---|
| accountName | string | Job name (e.g., 'police', 'ambulance') |
| balance | number | Initial balance (optional, default 0) |
Example:
exports['qb-banking']:CreateJobAccount('police', 50000)
CreateGangAccount
Create a gang/organization account.
exports['qb-banking']:CreateGangAccount(accountName, balance)
| Parameter | Type | Description |
|---|---|---|
| accountName | string | Gang name |
| balance | number | Initial balance (optional, default 0) |
Example:
exports['qb-banking']:CreateGangAccount('ballas', 10000)
GetAccount
Get account information.
local account = exports['qb-banking']:GetAccount(accountName)
Returns:
{
id = 1,
citizenid = 'ABC12345',
account_name = 'my-account',
account_balance = 5000,
account_type = 'shared',
users = {'ABC12345', 'DEF67890'},
}
GetAccountBalance
Get the balance of an account.
local balance = exports['qb-banking']:GetAccountBalance(accountName)
Returns: number - Account balance, or 0 if account doesn't exist.
Example:
local balance = exports['qb-banking']:GetAccountBalance('police')
print('Police fund: $' .. balance)
Money Operations
AddMoney
Add money to a shared/job/gang account.
exports['qb-banking']:AddMoney(accountName, amount, reason)
| Parameter | Type | Description |
|---|---|---|
| accountName | string | Account name |
| amount | number | Amount to add |
| reason | string | Transaction reason (optional) |
Returns: boolean - Success status
Example:
-- Add money to police fund from fine
exports['qb-banking']:AddMoney('police', 500, 'Traffic violation fine')
RemoveMoney
Remove money from a shared/job/gang account.
exports['qb-banking']:RemoveMoney(accountName, amount, reason)
| Parameter | Type | Description |
|---|---|---|
| accountName | string | Account name |
| amount | number | Amount to remove |
| reason | string | Transaction reason (optional) |
Returns: boolean - Success status (false if insufficient funds)
Example:
-- Pay for supplies from police fund
local success = exports['qb-banking']:RemoveMoney('police', 1000, 'Equipment purchase')
if not success then
print('Insufficient funds in police account')
end
CreateBankStatement
Record a transaction in a player's statement history.
exports['qb-banking']:CreateBankStatement(playerId, account, amount, reason, statementType, accountType)
| Parameter | Type | Description |
|---|---|---|
| playerId | number | Server ID |
| account | string | Account name |
| amount | number | Transaction amount |
| reason | string | Transaction description |
| statementType | string | 'deposit' or 'withdraw' |
| accountType | string | Account type (optional) |
Example:
exports['qb-banking']:CreateBankStatement(source, 'checking', 500, 'Job payment', 'deposit')
Card Operations
GetPlayerInventoryCards
Get all bank cards in a player's inventory.
local cards = exports['qb-banking']:GetPlayerInventoryCards(citizenid)
Returns: Array of card objects
ValidateCardAccess
Check if a player has access to use a card.
local hasAccess = exports['qb-banking']:ValidateCardAccess(cardNumber, citizenid)
ValidateCardPIN
Verify a card's PIN.
local isValid = exports['qb-banking']:ValidateCardPIN(cardNumber, pin)
IssueCardForAccount
Issue a new card for an account.
local result = exports['qb-banking']:IssueCardForAccount(accountName, citizenid, pin)
Returns:
{
success = true,
cardNumber = '1234567890123456',
}
-- or
{
success = false,
error = 'Max cards reached for this account',
}
RevokeCard
Revoke/cancel a card.
local success = exports['qb-banking']:RevokeCard(cardNumber)
GetCardsForAccount
Get all cards associated with an account.
local cards = exports['qb-banking']:GetCardsForAccount(accountName)
HasAccountAccess
Check if a player has access to an account.
local hasAccess = exports['qb-banking']:HasAccountAccess(accountName, citizenid)
GetAccessibleAccounts
Get all accounts a player can access.
local accounts = exports['qb-banking']:GetAccessibleAccounts(citizenid)
Loan Operations
ApplyForLoan
Submit a loan application.
local result = exports['qb-banking']:ApplyForLoan(citizenid, productType, amount, termDays)
| Parameter | Type | Description |
|---|---|---|
| citizenid | string | Player's citizen ID |
| productType | string | 'personal', 'vehicle', 'property', 'business', 'emergency' |
| amount | number | Loan amount requested |
| termDays | number | Loan term in days |
CheckLoanEligibility
Check if a player is eligible for a loan.
local result = exports['qb-banking']:CheckLoanEligibility(citizenid, productType, amount)
Returns:
{
eligible = true,
reasons = {},
}
-- or
{
eligible = false,
reasons = {'Credit score too low', 'Account age insufficient'},
}
CalculateLoanTerms
Get loan terms preview without applying.
local terms = exports['qb-banking']:CalculateLoanTerms(citizenid, productType, amount, termDays)
Returns:
{
principal = 10000,
interestRate = 0.06,
totalAmount = 10600,
paymentAmount = 1060,
numberOfPayments = 10,
}
GetPlayerLoans
Get all loans for a player.
local loans = exports['qb-banking']:GetPlayerLoans(citizenid)
MakeLoanPayment
Make a payment on a loan.
local result = exports['qb-banking']:MakeLoanPayment(citizenid, loanId, amount)
PayOffLoan
Pay off entire loan balance.
local result = exports['qb-banking']:PayOffLoan(citizenid, loanId)
GetLoanPaymentHistory
Get payment history for a loan.
local payments = exports['qb-banking']:GetLoanPaymentHistory(loanId)
CalculatePayoffAmount
Get current payoff amount for a loan.
local amount = exports['qb-banking']:CalculatePayoffAmount(loanId)
Credit Score
GetCreditScore
Get a player's credit score.
local score = exports['qb-banking']:GetCreditScore(citizenid)
Returns: number - Credit score (300-850)
Example:
local score = exports['qb-banking']:GetCreditScore(citizenid)
if score >= 700 then
print('Good credit!')
end
RecalculateCreditScore
Force recalculation of credit score.
local newScore = exports['qb-banking']:RecalculateCreditScore(citizenid)
Transaction Operations
CalculateTransactionFee
Calculate fee for a transaction type.
local fee = exports['qb-banking']:CalculateTransactionFee(feeType, amount, tier)
ApplyTransactionFee
Apply a fee to an account.
exports['qb-banking']:ApplyTransactionFee(citizenid, account, feeType, amount)
IsFeeWaived
Check if a fee is waived for a player.
local waived = exports['qb-banking']:IsFeeWaived(feeType, tier, balance)
CheckDailyLimit
Check if a transaction is within daily limits.
local result = exports['qb-banking']:CheckDailyLimit(citizenid, limitType, amount)
| limitType | Description |
|---|---|
| 'withdraw' | ATM withdrawal limit |
| 'transfer' | Transfer limit |
| 'deposit' | Deposit limit |
ProcessWireTransfer
Process a wire transfer between players.
local result = exports['qb-banking']:ProcessWireTransfer(fromCitizenid, toCitizenid, amount, transferType)
| transferType | Fee |
|---|---|
| 'domestic' | $15 |
| 'international' | $50 |
Business Operations
CreateInvoice
Create a business invoice.
local result = exports['qb-banking']:CreateInvoice(fromCitizenid, toCitizenid, amount, description)
PayInvoice
Pay an invoice.
local result = exports['qb-banking']:PayInvoice(invoiceId, payerCitizenid)
RecordExpense
Record a business expense.
exports['qb-banking']:RecordExpense(citizenid, jobName, category, amount, description)
| category | Description |
|---|---|
| 'supplies' | Supplies & materials |
| 'utilities' | Utility bills |
| 'vehicle' | Vehicle expenses |
| 'property' | Property costs |
| 'legal' | Legal fees |
| 'marketing' | Marketing costs |
| 'other' | Other expenses |
Utility Functions
CheckRateLimit
Check if an action is rate limited.
local allowed, waitTime = exports['qb-banking']:CheckRateLimit(citizenid, action)
CreateSuccessResponse
Create a standardized success response.
local response = exports['qb-banking']:CreateSuccessResponse(data)
-- Returns: { success = true, data = data }
CreateErrorResponse
Create a standardized error response.
local response = exports['qb-banking']:CreateErrorResponse(message, code)
-- Returns: { success = false, error = message, code = code }
Common Integration Examples
Job Payment to Business Account
-- When a player completes a job, add payment to business fund
RegisterServerEvent('myresource:server:jobCompleted')
AddEventHandler('myresource:server:jobCompleted', function(amount)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
local jobName = Player.PlayerData.job.name
-- Add to job account
exports['qb-banking']:AddMoney(jobName, amount, 'Job revenue')
end)
Check Credit Before Loan in Custom Script
-- Check if player qualifies for your custom loan
function CanPlayerGetLoan(citizenid, minCredit)
local score = exports['qb-banking']:GetCreditScore(citizenid)
return score >= minCredit
end
-- Usage
if CanPlayerGetLoan(Player.PlayerData.citizenid, 650) then
-- Approve custom loan
end
Fine System with Bank Integration
-- Issue a fine and deposit to police fund
function IssueFine(targetSource, amount, reason)
local Player = QBCore.Functions.GetPlayer(targetSource)
if not Player then return false end
-- Remove from player's bank
if Player.Functions.RemoveMoney('bank', amount, reason) then
-- Add to police fund
exports['qb-banking']:AddMoney('police', amount, reason)
-- Log the transaction
exports['qb-banking']:CreateBankStatement(
targetSource,
'checking',
amount,
'Fine: ' .. reason,
'withdraw'
)
return true
end
return false
end
Check Account Balance Before Purchase
-- Check if job has enough funds for a purchase
function CanJobAfford(jobName, amount)
local balance = exports['qb-banking']:GetAccountBalance(jobName)
return balance >= amount
end
-- Usage in purchase system
if CanJobAfford('police', 5000) then
exports['qb-banking']:RemoveMoney('police', 5000, 'Equipment purchase')
-- Give equipment
end
Shared Account for Organizations
-- Create a shared account for a player organization
RegisterServerEvent('myresource:server:createOrgAccount')
AddEventHandler('myresource:server:createOrgAccount', function(orgName, members)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
-- Create account with owner and members
local accountName = 'org-' .. orgName:lower()
local users = {Player.PlayerData.citizenid}
-- Add member citizenids
for _, memberId in ipairs(members) do
local member = QBCore.Functions.GetPlayer(memberId)
if member then
table.insert(users, member.PlayerData.citizenid)
end
end
exports['qb-banking']:CreatePlayerAccount(src, accountName, 0, users)
end)
Oxide Banking by Oxide Studios