Exports

Exports

Use these exports in other scripts to integrate with the billing system. Client exports are called from client-side scripts and server exports from server-side scripts.

Client Exports

Open — Open Billing UI

Opens the billing interface for the local player.

exports['bablo-billing']:Open()

OpenJob — Open Billing with Job Access

Checks job permissions and grants job account access, then opens the billing UI. Use this when you want to restrict job billing to specific interactions (e.g. on duty).

exports['bablo-billing']:OpenJob()

Example usage in a job script:

RegisterCommand('police_billing', function()
    exports['bablo-billing']:OpenJob()
end, false)

OpenJob respects Config.JobAccount.blockedJobs. If the player's job is blocked, a notification is shown and the UI will not open.

CanAccessJobAccount — Check Job Account Access

Returns true if the local player currently has access to job accounts, false otherwise.

local canAccess = exports['bablo-billing']:CanAccessJobAccount()
if canAccess then
    print('Player has job account access')
end

When Config.JobAccount.requireJobOpen = false, this always returns true. When requireJobOpen = true, access is only granted after OpenJob is called.


Server Exports

createInvoice / CreateInvoice — Create an Invoice

Creates a new invoice from a sender to a recipient.

exports['bablo-billing']:createInvoice({
    from = 'steam:110000100000000',   -- Sender's identifier
    to   = 'steam:110000100000001',   -- Recipient's identifier
    title       = 'Vehicle Repair',
    description = 'Engine replacement and paint job',
    amount      = 15000
})
ParameterTypeDescription
fromstringSender's player identifier
tostringRecipient's player identifier
titlestringInvoice title
descriptionstringInvoice description (optional)
amountnumberAmount to invoice
due_datenumberUnix timestamp in ms for due date (optional)

getInvoice — Get Invoice Data

Retrieves invoice data by ID.

local invoice = exports['bablo-billing']:getInvoice('invoice-uuid-here')

payInvoice — Pay an Invoice

Pays an invoice programmatically on behalf of a player.

local success = exports['bablo-billing']:payInvoice('invoice-uuid-here', 'steam:110000100000000')
ParameterTypeDescription
invoiceIdstringThe invoice UUID
identifierstringThe player identifier paying the invoice

deleteInvoice — Delete an Invoice

Deletes an invoice by ID.

exports['bablo-billing']:deleteInvoice('invoice-uuid-here')