Skip to main content

Exports

Here are the various exports and their type-definitions:

FetchInvoices

-- Fetch all personal received invoices.
exports["vivum-billing"]:FetchInvoices(source, "received", { id = "__me", label = "Me" }, function(res)
print(res.status, res.invoices)
end)

-- Fetch all personal sent invoices.
exports["vivum-billing"]:FetchInvoices(source, "sent", { id = "__me", label = "Me" }, function(res)
print(res.status, res.invoices)
end)


-- Fetch all invoices for a society (player must have that job)
exports["vivum-billing"]:FetchInvoices(source, "received", { id = "police", label = "LSPD" }, function(res)
print(res.status, res.invoices)
end)

SendInvoice

local invoiceData = {
sender = '__me',
sender_label = 'Me',
recipient = 'police',
recipient_label = 'LSPD',
amount = 10000,
payments_num = 1,
payments_period = 7, -- (in days)
summary = "Summary"
}

exports["vivum-billing"]:SendInvoice(source, invoiceData, function(res)
print(res.status) -- OK or FAILED
end)

PayInvoice

local invoiceData = {
id = 1, -- Incremental Invoice ID
sender = '__me',
sender_label = 'Me',
recipient = 'police',
recipient_label = 'LSPD',
}

exports["vivum-billing"]:PayInvoice(source, invoiceData, function(res)
print(res.status) -- OK or FAILED
end)

CancelInvoice

local invoiceData = { id = 1, sender = '018510250', ... } -- id and sender only technically needed, however ALL data is standardly available since we need notification locales.

exports["vivum-billing"]:CancelInvoice(source, invoiceData, function(res)
print(res.status) -- OK or FAILED
end)