Home › Documentation › LB Phone App · origen_billing
origen_billingapp is the companion LB Phone application for origen_billing. It provides a full billing experience directly inside the phone — no commands required.
| Resource | Notes |
|---|---|
lb-phone | Required. The app registers itself via exports['lb-phone']:AddCustomApp |
origen_billing | Required. All business logic is delegated to its phone exports |
ox_lib | Required. Locale utilities |
Add origen_billingapp after origen_billing and lb-phone:
ensure lb-phone
ensure origen_billing
ensure origen_billingappOpen config.lua and set the language. It must match a file in locales/:
Config.Language = 'en' -- 'en' | 'es'No SQL is required. origen_billingapp does not create any tables — all data is stored and managed by origen_billing.
The app registers itself in LB Phone on resource start and automatically re-registers if lb-phone restarts. The UI communicates exclusively through NUI callbacks → server events → origen_billing phone exports → client event response back to the phone UI.
UI (NUI)
└─▶ NUI Callback (client.lua)
└─▶ Server Event (origen_billingapp:server:*)
└─▶ origen_billing Phone Export
└─▶ TriggerClientEvent → origen_billingapp:client:response
└─▶ exports['lb-phone']:SendCustomAppMessageNo business logic lives in origen_billingapp. It is a pure bridge.
The app uses the following exports registered on origen_billing. These can also be called from other resources.
GetPhoneAppBootstrap(source) → tableLoads all data needed to open the app in a single call. Returns permissions, pending invoices, catalog products, and — for bosses — company invoices, stats, and products.
local data = exports['origen_billing']:GetPhoneAppBootstrap(source)
-- {
-- success = true,
-- permissions = { canInvoice, isBoss, jobName, jobLabel },
-- myInvoices = { ... },
-- catalogProducts = { ... },
-- companyInvoices = { ... }, -- nil if not boss
-- companyMeta = { page, pageSize, total, totalPages },
-- companyStats = { ... },
-- companyProducts = { ... },
-- }GetPhonePermissions(source) → tableReturns the current permissions for the player. Called when the player's job changes.
local res = exports['origen_billing']:GetPhonePermissions(source)
-- { success = true, permissions = { canInvoice, isBoss, jobName, jobLabel } }GetPhoneMyInvoices(source) → tableReturns the player's pending invoices.
local res = exports['origen_billing']:GetPhoneMyInvoices(source)
-- { success = true, invoices = { ... } }PayPhoneInvoice(source, invoiceId, paymentMethod) → tablePays an invoice. paymentMethod is 'bank' or 'cash'.
local res = exports['origen_billing']:PayPhoneInvoice(source, 12, 'bank')
-- { success = true|false, reason = 'error_code' }GetPhoneProducts(source) → tableReturns the active product catalog for the player's job.
local res = exports['origen_billing']:GetPhoneProducts(source)
-- { success = true, products = { { id, name, description, price }, ... } }SendPhoneInvoice(source, payload) → tableCreates an invoice from the phone. payload.items is optional — if omitted, a single-line invoice is created from payload.amount and payload.description.
local res = exports['origen_billing']:SendPhoneInvoice(source, {
targetId = 'ABC12345',
amount = 500,
description = 'Service fee',
notes = '',
items = {
{ name = 'Oil change', price = 150, quantity = 1, product_id = 5 },
},
})
-- { success = true, invoiceId = 42 }GetPhoneCompanyInvoicesPage(source, filters) → tableReturns a paginated and filtered list of company invoices. Boss only.
local res = exports['origen_billing']:GetPhoneCompanyInvoicesPage(source, {
search = 'John',
status = 'pending', -- 'all' | 'pending' | 'paid' | 'cancelled'
minAmount = 100,
maxAmount = 1000,
dateFrom = '2025-01-01',
dateTo = '2025-12-31',
page = 1,
pageSize = 10,
})
-- { success, invoices, meta = { page, pageSize, total, totalPages }, stats = { ... } }GetPhoneCompanyStats(source) → tableReturns global statistics for the player's company. Boss only.
local res = exports['origen_billing']:GetPhoneCompanyStats(source)
-- { success, stats = { total, pending, paid, cancelled, totalSociety, totalCommissions, avgAmount } }GetPhoneCompanyDashboardLite(source, dateFrom, dateTo) → tableReturns KPIs and a daily time series for a date range. Boss only.
local res = exports['origen_billing']:GetPhoneCompanyDashboardLite(source, '2025-01-01', '2025-01-31')
-- {
-- success = true,
-- kpis = { total, pending, paid, cancelled, totalRevenue, totalSociety, totalCommissions, avgAmount },
-- timeSeries = { { day, totalAmount, paidAmount }, ... },
-- }CancelPhoneCompanyInvoice(source, invoiceId) → tableCancels a company invoice. Caller must be a boss of the job that issued it.
local res = exports['origen_billing']:CancelPhoneCompanyInvoice(source, 42)
-- { success = true|false, reason = 'error_code' }GetPhoneCompanyProducts(source) → tableReturns all products for the player's company (including inactive ones). Boss only.
local res = exports['origen_billing']:GetPhoneCompanyProducts(source)
-- { success, products = { { id, name, description, price, active, created_at }, ... } }CreatePhoneCompanyProduct(source, data) → tableCreates a new product for the company. Boss only.
local res = exports['origen_billing']:CreatePhoneCompanyProduct(source, {
name = 'Oil change',
description = 'Full synthetic',
price = 150,
})
-- { success = true, productId = 7 }UpdatePhoneCompanyProduct(source, data) → tableUpdates an existing product. Boss only.
local res = exports['origen_billing']:UpdatePhoneCompanyProduct(source, {
id = 7,
name = 'Oil change (premium)',
description = 'Full synthetic + filter',
price = 200,
})
-- { success = true|false }TogglePhoneCompanyProduct(source, productId) → tableToggles a product between active and inactive. Boss only.
local res = exports['origen_billing']:TogglePhoneCompanyProduct(source, 7)
-- { success = true, active = false }DeletePhoneCompanyProduct(source, productId) → tablePermanently deletes a product. Boss only.
local res = exports['origen_billing']:DeletePhoneCompanyProduct(source, 7)
-- { success = true|false }