Exports
Client and server exports available from wasabi_billing. These are useful for job menus, radial menus, and third-party billing integrations.
The resource folder must be named wasabi_billing for these exports to resolve.
Client exportsβ
UI-opening exports take no parameters and return no value. They do nothing if the dashboard is already open.
isUIOpenβ
Returns whether the billing UI (dashboard or invoice receipt) is currently open.
local uiOpen = exports.wasabi_billing:isUIOpen()
if uiOpen then
print('Billing UI is open')
end
There is no public CloseUI export. Use the client wasabi_billing:closeUI event instead; see Events.
openBillingMenuβ
Opens the billing dashboard on Overview.
exports.wasabi_billing:openBillingMenu()
openCreateInvoiceβ
Opens Overview with the Create Invoice modal.
exports.wasabi_billing:openCreateInvoice()
openPayReferenceβ
Opens Overview with Pay by Reference.
exports.wasabi_billing:openPayReference()
openInspectCitizenβ
Opens the admin view with the inspection modal. Opening an admin view does not bypass server-side admin checks.
exports.wasabi_billing:openInspectCitizen()
Server exportsβ
CreateInvoiceβ
Creates an invoice and returns its reference string, or nil on validation failure.
local reference = exports.wasabi_billing:CreateInvoice(
authorSource, targetIdentifier, amount, reason,
invoiceType, targetType, referenceId
)
| Parameter | Type | Description |
|---|---|---|
authorSource | number | Online issuing player's server ID, not their character identifier. |
targetIdentifier | string | Billed character's persistent identifier/citizenid, or raw job name for a society target. Not a target server ID. |
amount | number | Positive amount before VAT; floored to a whole unit. |
reason | string | Invoice description. Keep within 200 characters. |
invoiceType | string? | 'personal' (default) or 'society'. Society issuer is resolved from the issuing player's job. |
targetType | string? | 'personal' (default) or 'society'. Independent of the issuer type. |
referenceId | string? | Optional unique reference. Otherwise generated with Config.ReferenceIdPrefix. |
local reference = exports.wasabi_billing:CreateInvoice(
officerSource, targetCharacterIdentifier, 250,
'Traffic fine', 'society', 'personal'
)
if reference then
print(('Created invoice %s'):format(reference))
end
The issuer should be a valid online player. The target can be an offline character by persistent identifier. Society targets must be on the receive allow-list and require a society banking backend.
This export skips the UI's society send-grade check, Config.MaxCustomAmount, proximity checks, and preset validation. Validate callers on the server before invoking it. Do not expose it through an unrestricted network event.
GetInvoiceβ
Returns one invoice row by reference, or nil if no record exists.
local invoice = exports.wasabi_billing:GetInvoice(referenceId)
if invoice then
print(invoice.reference_id, invoice.status, invoice.daysRemaining)
end
status is adjusted to effective overdue status and daysRemaining is added. Other fields retain the database row shape; this is not the NUI camelCase DTO.
| Field | Description |
|---|---|
id | Numeric database row ID. |
reference_id | Public reference string. |
author_identifier, author_name | Issuing character or society identifier and display name. |
receiver_identifier, receiver_name | Billed character or society identifier and display name. |
invoicer_identifier | Issuing employee identifier; may be null on imported records. |
invoice_type | Issuer type: 'personal' or 'society'. |
receiver_type | Receiver type: 'personal' or 'society'. |
reason | Invoice description. |
amount | Pre-VAT amount. |
vat_amount | Stored VAT amount. |
total_amount | Stored total. |
status | 'unpaid', 'overdue', 'paid', or 'cancelled'. |
payment_method | 'bank' or 'cash' when recorded. |
sent_date, limit_pay_date | Stored date strings, normally YYYY-MM-DD HH:MM:SS. |
paid_date | Payment date string, or null. |
daysRemaining | Whole days remaining, rounded up; zero after expiry. |
GetInvoicesByIdentifierβ
Returns invoices tied to a character identifier/citizenid or society job name. Same row shape as GetInvoice.
local invoices = exports.wasabi_billing:GetInvoicesByIdentifier(identifier)
for _, invoice in ipairs(invoices) do
print(invoice.reference_id, invoice.status)
end
Returns an array (empty when nothing matches), newest database IDs first, limited to 200 records. Matches receiver, author, or invoicer_identifier. These reads are not filtered by the calling player's visibility; apply your own authorization before sending results to clients.
PayInvoiceByReferenceβ
Settles an invoice on a player's behalf.
local paid = exports.wasabi_billing:PayInvoiceByReference(
payerSource, referenceId, 'bank'
)
| Parameter | Type | Description |
|---|---|---|
payerSource | number | Online player initiating the payment. |
referenceId | string | Invoice to settle. |
paymentMethod | string? | 'bank' or 'cash'. Omitted uses Config.PreferredPaymentMethod for a personal receiver. |
Returns true on success, false on normal rejection. Failure notifications are sent to the supplied player.
For a personal receiver, the supplied player pays from their own account even if the invoice is addressed to another character. For a society receiver, the billed society's account is debited; that requires an admin or a member of that job with its management grade. This is not an offline debtor-collection command.
CancelInvoiceβ
Cancels an unpaid invoice. Does not refund a paid invoice.
local cancelled = exports.wasabi_billing:CancelInvoice(actorSource, referenceId)
| Parameter | Type | Description |
|---|---|---|
actorSource | number | Acting player's server ID. |
referenceId | string | Invoice reference to cancel. |
Returns true on success, false on rejection. Allowed actors are administrators, the author, the stored issuing employee, or an appropriately ranked member of the issuing society. Rows stored as overdue cannot be cancelled through this path.
invoiceβ
Inventory protocol callback used by ox_inventory when Config.InvoiceItem is set. The export name follows the configured item name.
server = { export = 'wasabi_billing.invoice' }
ox_inventory calls the handler as (event, item, inv, slot). Billing responds only to event == 'usingItem' and opens the invoice matching metadata.reference_id. This is not a general-purpose invoice-opening API. See Installation.
Compatibility exportsβ
When enabled in Config.CompatExports, wasabi_billing also answers export calls aimed at replaced billing resources. See Migration for setup rules.
codem-billingβ
| Export | Purpose |
|---|---|
createBilling | Create an invoice from issuer and target server IDs. Amount is pre-VAT; optional society is normalized by stripping society_. Returns a reference or nil. |
CheckBilling | Count of unpaid/overdue received invoices among the latest 200 received records for a player server ID. |
local reference = exports['codem-billing']:createBilling(
issuerSource, targetServerId, amount, reason, society
)
local count = exports['codem-billing']:CheckBilling(playerSource)
These are not exports on exports.wasabi_billing. The real codem-billing resource must be removed. wasabi_billing provides it in fxmanifest.lua.