Exports
Series of exports available within our Complete Billing (wasabi_billing) resource. These are good for implementing radial menus and usage of 3rd party scripts.
Client Exportsβ
openBillingMenuβ
openBillingMenu
exports.wasabi_billing:openBillingMenu()
Opens the billing dashboard.
openCreateInvoiceβ
openCreateInvoice
exports.wasabi_billing:openCreateInvoice()
Opens the create invoice UI.
openPayReferenceβ
openPayReference
exports.wasabi_billing:openPayReference()
Opens the pay by reference ID UI.
openInspectCitizenβ
openInspectCitizen
exports.wasabi_billing:openInspectCitizen()
Opens the citizen inspection UI (If permitted).
Server Exportsβ
CreateInvoiceβ
CreateInvoice
local referenceId = exports.wasabi_billing:CreateInvoice(authorSource, targetIdentifier, amount, reason, invoiceType, targetType, referenceId)
if not referenceId then
print('failed to create invoice')
else
print('successful invoice created. reference id: '..referenceId)
end
Create an invoice. Returns reference ID if successful OR nil if failed.
authorSource: source ID of the player creating the invoice / NUMBER
targetIdentifier: citizen ID / identifier or society name of the receiver / STRING
amount: invoice amount (before VAT) / NUMBER
reason: reason for the invoice / STRING
invoiceType: "personal" or "society" / STRING | ENUM
targetType: "personal" or "society" / STRING | ENUM
referenceId (Optional): Custom Reference ID, if not provided will auto-generate / STRING
GetInvoiceβ
GetInvoice
local invoiceData = exports.wasabi_billing:GetInvoice(referenceId)
if not invoiceData then
print('failed to find invoice')
else
print('reference_id = '..invoiceData.reference_id)
print('author_identifier = '..invoiceData.author_identifier)
print('author_name = '..invoiceData.author_name)
print('receiver_identifier = '..invoiceData.receiver_identifier)
print('receiver_name = '..invoiceData.receiver_name)
print('invoicer_identifier = '..invoiceData.invoicer_identifier)
print('invoice_type = '..invoiceData.invoice_type)
print('reason = '..invoiceData.reason)
print('amount = '..invoiceData.amount)
print('vat_amount = '..invoiceData.vat_amount)
print('total_amount = '..invoiceData.total_amount)
print('status = '..invoiceData.status)
print('sent_date = '..invoiceData.sent_date)
print('limit_pay_date = '..invoiceData.limit_pay_date)
print('limit_pay_date = '..invoiceData.limit_pay_date)
print('daysRemaining = '..invoiceData.daysRemaining)
end
Returns the invoice data of a queried reference ID or nil if not found.
Parameters
referenceId: Reference ID of the payment you want to retrieve / STRING
Returns nil if no invoice found OR a table of invoice data:
reference_id= The reference ID of the invoice (string)author_identifier= The author's identifier (string)author_name= The author's name (string)receiver_identifier= The receiver's identifier (string)invoice_type= Either"personal"or"society"(enum<string>)reason= The reason for the invoice (string)amount= The amount of the invoice (before VAT) (number)vat_amount= The amount to pay in VAT (number)total_amount= The total amount of the invoice with fees.status= Either"paid","unpaid","cancelled", or"overdue"(enum<string>)sent_date= Date of invoice sentlimit_pay_date= The due date the invoice needs paid before becoming "overdue"daysRemaining= The amount of days left before invoice is overdue. (number)
GetInvoicesByIdentifierβ
GetInvoicesByIdentifier
local invoiceData = exports.wasabi_billing:GetInvoicesByIdentifier(identifier)
if not invoiceData or not next(invoiceData) then
print('failed to find any invoices')
else
print('Found '..#invoiceData..' invoices for identifier: '..identifier)
end
Retrieves an array of objects of invoice data related to the identifier provided in the parameter.
Parameters
identifier: A citizen ID/identifier OR society name / STRING
Returns nil or an empty table if no invoices found OR an array of tables of invoice data:
reference_id= The reference ID of the invoice (string)author_identifier= The author's identifier (string)author_name= The author's name (string)receiver_identifier= The receiver's identifier (string)invoice_type= Either"personal"or"society"(enum<string>)reason= The reason for the invoice (string)amount= The amount of the invoice (before VAT) (number)vat_amount= The amount to pay in VAT (number)total_amount= The total amount of the invoice with fees.status= Either"paid","unpaid","cancelled", or"overdue"(enum<string>)sent_date= Date of invoice sentlimit_pay_date= The due date the invoice needs paid before becoming "overdue"daysRemaining= The amount of days left before invoice is overdue. (number)
PayInvoiceByReferenceβ
PayInvoiceByReference
local successfullyPaid = exports.wasabi_billing:PayInvoiceByReference(source, referenceId, paymentMethod)
if not successfullyPaid then
print('failed to pay invoice')
else
print('Successfully paid the invoice: '..referenceId)
end
Pays a specific invoice for a user correlating with the passed referenceId and optional paymentMethod. Returns true if successfully paid or else false.
Parameters
source: The player source that wants to pay the invoice / NUMBER
referenceId: The reference ID of the invoice desired to pay / STRING
paymentMethod (optional):** The payment method to use (if not defined will use configured default) /** STRING
Returns true if successfully paid or else false.