Browse docs
Server: Advanced Billing 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
| Export | Arguments | Purpose |
|---|---|---|
CreateInvoice | source, payload | Creates a validated invoice for configured work, positions, or permitted manual lines |
CreateEstimate | source, payload | Creates a time-limited estimate using the same validation and price boundaries |
GetInvoice | source, invoiceId | Returns one invoice to its customer or an authorized workshop manager |
GetPlayerInvoices | source, limit? | Returns up to 100 invoices belonging to that player |
PayInvoice | source, payload | Pays the server-calculated balance or an allowed partial amount |
RespondToEstimate | source, payload | Accepts or declines an estimate owned by the player |
SendInvoiceReminder | source, payload | Sends a permission- and cooldown-checked overdue reminder |
CancelInvoice | source, payload | Cancels an unpaid document when the mechanic grade permits it |
GetBillingAnalytics | source, periodDays? | Returns the authorized workshop's accounting summary |
Creating an invoice or estimate
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
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
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)
RegisterNetEvent. If a client UI needs an action, let the existing Mechanic callbacks perform the server-side validation.