Browse docs

Server: Advanced Billing exports

Reference for Server: Advanced Billing exports in mechanicjob.

All exports

This page documents supported public integration calls and usage examples. It does not expose or reproduce the resource's internal implementation.

Server Exports

All Advanced Pricing and Billing exports return a result table:

{
    success = true,
    data = {}
}

Rejected requests return success = false and a stable error code. Player identity, mechanic job, grade, permissions, vehicle distance, configured limits, quote state, invoice ownership, and monetary values are always resolved or validated on the server.

Advanced Billing exports

ExportArgumentsPurpose
CreateInvoicesource, payloadCreates a validated invoice for configured work, positions, or permitted manual lines
CreateEstimatesource, payloadCreates a time-limited estimate using the same validation and price boundaries
GetInvoicesource, invoiceIdReturns one invoice to its customer or an authorized workshop manager
GetPlayerInvoicessource, limit?Returns up to 100 invoices belonging to that player
PayInvoicesource, payloadPays the server-calculated balance or an allowed partial amount
RespondToEstimatesource, payloadAccepts or declines an estimate owned by the player
SendInvoiceRemindersource, payloadSends a permission- and cooldown-checked overdue reminder
CancelInvoicesource, payloadCancels an unpaid document when the mechanic grade permits it
GetBillingAnalyticssource, periodDays?Returns the authorized workshop's accounting summary

Creating an invoice or estimate

server.lua
local invoice = exports["sky_mechanicjob"]:CreateInvoice(source, {
    targetId = customer_source,
    plate = "ABC123",
    historyIds = { 481, 482 },
    customPositionKeys = { "diagnostics" },
    discountPercent = 5
})

local estimate = exports["sky_mechanicjob"]:CreateEstimate(source, {
    targetId = customer_source,
    manualItems = {
        {
            label = "Custom fabrication",
            category = "bodywork",
            costType = "labor",
            quantity = 2,
            unitPrice = 750
        }
    }
})

Manual positions, custom prices, discounts, document totals, and estimates must be enabled for the mechanic's grade. The customer must be online and within eight meters when targetId is used.

Reading and paying invoices

server.lua
local invoice = exports["sky_mechanicjob"]:GetInvoice(source, invoice_id)
local invoices = exports["sky_mechanicjob"]:GetPlayerInvoices(source, 25)

local payment = exports["sky_mechanicjob"]:PayInvoice(
    source,
    {
        invoiceId = invoice_id,
        paymentMethod = "card",
        amount = 500
    }
)

The server loads the invoice owner and outstanding balance, enforces the deposit and minimum partial payment, removes the money, deposits workshop funds, records the payment, and updates the status. Supplying a larger amount cannot overpay the invoice.

Estimate and management actions

server.lua
exports["sky_mechanicjob"]:RespondToEstimate(customer_source, {
    invoiceId = estimate_id,
    accepted = true
})
exports["sky_mechanicjob"]:SendInvoiceReminder(mechanic_source, {
    invoiceId = invoice_id
})
exports["sky_mechanicjob"]:CancelInvoice(mechanic_source, {
    invoiceId = invoice_id,
    reason = "Created by mistake"
})

local analytics = exports["sky_mechanicjob"]:GetBillingAnalytics(mechanic_source, 30)
These are server exports. Do not proxy them through an unvalidated RegisterNetEvent. If a client UI needs an action, let the existing Mechanic callbacks perform the server-side validation.