Exports & API
Core Business exposes exports for data access, business management, and a powerful closest-property API that lets any external script turn a property into a functional node (clothing store, ATM, fuel station, etc.).
Client Exports
client
exports['core_business']:OpenRegistry()Opens the business registry UI for the local player.
Example
lua
exports['core_business']:OpenRegistry()client
exports['core_business']:IsRegistryOpen()Returns whether the business NUI is currently open.
Returns:
booleanExample
lua
if exports['core_business']:IsRegistryOpen() then
print('Business UI is open')
endServer Exports — Data Access
server
exports['core_business']:GetBusiness(id)Returns a business object by ID from the cache.
| Parameter | Type | Description |
|---|---|---|
id | number | Business ID |
Returns:
Business | nilExample
lua
local business = exports['core_business']:GetBusiness(1)
if business then
print('Business:', business.name, 'Balance:', business.balance)
endserver
exports['core_business']:GetProperty(id)Returns a property object by ID from the cache.
| Parameter | Type | Description |
|---|---|---|
id | number | Property ID |
Returns:
Property | nilExample
lua
local property = exports['core_business']:GetProperty(5)
if property then
print('Property:', property.name, 'Type:', property.type)
endserver
exports['core_business']:GetEmployee(id)Returns an employee object by ID from the cache.
| Parameter | Type | Description |
|---|---|---|
id | number | Employee ID |
Returns:
Employee | nilExample
lua
local employee = exports['core_business']:GetEmployee(12)
if employee then
print('Employee:', employee.name, 'Role:', employee.role)
endserver
exports['core_business']:GetPlayerBusinesses(identifier)Returns all businesses where the player is a shareholder.
| Parameter | Type | Description |
|---|---|---|
identifier | string | Player identifier (citizenid or ESX identifier) |
Returns:
tableExample
lua
local businesses = exports['core_business']:GetPlayerBusinesses(citizenid)
for _, business in ipairs(businesses) do
print('Owns:', business.name)
endServer Exports — Creation
server
exports['core_business']:CreateBusiness(name, ownerIdentifier, ownerPercent)Creates a new business. The specified player becomes the owner with the given share percentage.
| Parameter | Type | Description |
|---|---|---|
name | string | Business name |
ownerIdentifier | string | Player identifier |
ownerPercent | number | Owner share percentage (default 100) |
Returns:
Business | nilExample
lua
local business = exports['core_business']:CreateBusiness('Los Santos Logistics', citizenid, 100)server
exports['core_business']:CreateProperty(data)Creates a new property from a data table.
| Parameter | Type | Description |
|---|---|---|
data | table | Property data (name, type, access_points, price, etc.) |
Returns:
Property | nilExample
lua
local property = exports['core_business']:CreateProperty({
name = 'Downtown Mine',
type = 'mining_facility',
price = 500000,
access_points = { entrance = vector3(100, 200, 30) }
})Server Exports — Closest Property API
These exports are the integration layer for external scripts. They find the closest property to a given coordinate and perform operations on it. This is how you turn any property into a node for another system (clothing, fuel, banking, etc.).
How It Works
Each export finds the closest property within 50 meters of the given coordinates by checking all access points. If no property is found, the exports return safe defaults (items return 1000.0, mutations return true) so external scripts don't break.
server
exports['core_business']:closestPropertyItemCount(coords, item)Returns the total count of an item across all storages of the closest property. Returns 1000.0 if no property found (safe fallback so checks always pass).
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | World coordinates to search from |
item | string | Item name to count |
Returns:
numberExample
lua
-- Check if a clothing store property has enough stock
local count = exports['core_business']:closestPropertyItemCount(
GetEntityCoords(GetPlayerPed(source)), 'clothing_item'
)
if count > 0 then
-- Allow the sale
endserver
exports['core_business']:closestPropertyRemoveItem(coords, item, amount)Removes an item from the closest property's storage. Returns true if no property found.
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | World coordinates to search from |
item | string | Item name to remove |
amount | number | Amount to remove |
Returns:
booleanExample
lua
-- Remove fuel from a gas station property when a player fuels up
exports['core_business']:closestPropertyRemoveItem(pumpCoords, 'fuel', 50)server
exports['core_business']:closestPropertyAddItem(coords, item, amount)Adds an item to the closest property's storage. Returns true if no property found.
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | World coordinates to search from |
item | string | Item name to add |
amount | number | Amount to add |
Returns:
booleanExample
lua
-- Add returned clothing to the store inventory
exports['core_business']:closestPropertyAddItem(storeCoords, 'clothing_item', 1)server
exports['core_business']:closestPropertyRegisterSale(coords, money, log)Registers income to the business that owns the closest property. The money is added to the business balance, recorded as a financial transaction, and tracked in statistics.
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | World coordinates to search from |
money | number | Amount of income |
log | string | Transaction description (optional) |
Returns:
booleanExample
lua
-- Register a fuel sale at a gas station
exports['core_business']:closestPropertyRegisterSale(
pumpCoords, 500, 'Fuel sale: 50L'
)server
exports['core_business']:closestPropertyRegisterExpense(coords, money, log)Registers an expense (deduction) from the business that owns the closest property.
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | World coordinates to search from |
money | number | Expense amount (will be made negative) |
log | string | Transaction description (optional) |
Returns:
booleanExample
lua
-- Deduct supply cost from the business
exports['core_business']:closestPropertyRegisterExpense(
storeCoords, 200, 'Restocking supplies'
)server
exports['core_business']:closestPropertyGetPrice(coords, item, mode)Returns the market listing price for an item at the closest property. Falls back to default_market prices for unowned properties.
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | World coordinates to search from |
item | string | Item name |
mode | string | sell (property sells to player) or buy (property buys from player) |
Returns:
number | nilExample
lua
-- Get the price of fuel at the nearest gas station
local price = exports['core_business']:closestPropertyGetPrice(
pumpCoords, 'fuel', 'sell'
)
if price then
print('Fuel costs $' .. price .. ' per unit')
endserver
exports['core_business']:closestPropertyGetBusinessId(coords)Returns the business ID that owns the closest property. Useful for passing into Core Pay or any other export that needs a business ID.
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | World coordinates to search from |
Returns:
number | nilExample
lua
-- Get the business ID of the nearest property
local coords = GetEntityCoords(GetPlayerPed(source))
local businessId = exports['core_business']:closestPropertyGetBusinessId(coords)
if businessId then
-- Use with Core Pay, billing, or any business operation
exports['core_business']:requestCorePay(source, businessId, 100, 'Service fee')
endServer Exports — Core Pay
Core Pay is a built-in billing UI that prompts the player to authorize a payment with a signature. The player sees the business name, logo, amount, and a signature canvas — they sign and hit "Authorize" to confirm, or cancel to decline. The payment is deducted from the player's bank and credited to the target business balance.
Use this export to trigger Core Pay from any script — for example, custom shops, services, or integrations that need a visual payment flow tied to a business.
server
exports['core_business']:requestCorePay(source, businessId, amount, description, callback)Opens the Core Pay billing UI for a player. The player sees the business logo, payment amount, and a signature canvas. On authorize, the amount is deducted from the player's bank and added to the business balance. On cancel or insufficient funds, the callback receives false.
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
businessId | number | Target business ID to receive the payment |
amount | number | Payment amount in dollars |
description | string | Payment reason shown in the UI (default: Payment) |
cb | function | Callback — receives (success, message). Optional. |
Returns:
void (result via callback)Example
lua
-- Charge a player $250 for a service at business ID 3
exports['core_business']:requestCorePay(source, 3, 250, 'Vehicle Detailing', function(success, message)
if success then
print('Payment authorized')
-- Give the player the service
else
print('Payment failed:', message)
end
end)How Core Pay Works
- Your script calls
requestCorePaywith the player, business, and amount - The player sees a billing panel with the business logo, amount, and a signature canvas
- The player signs and clicks Authorize — or clicks Cancel
- Core Business deducts from the player's bank, credits the business balance, and logs the transaction
- Your callback fires with
(true, "Payment successful")or(false, reason)
Core Pay with Closest Property
Use closestPropertyGetBusinessId to charge the player at whichever business owns the nearest property:
lua
local coords = GetEntityCoords(GetPlayerPed(source))
local businessId = exports['core_business']:closestPropertyGetBusinessId(coords)
if businessId then
exports['core_business']:requestCorePay(
source, businessId, 150, 'Store Purchase',
function(success, msg)
if success then
-- Give the player the goods/service
end
end
)
endFor integration examples using these exports, see the Integrations page.
