Exports

Comprehensive instructions on configuring files and utilizing export functions.

Billing Exports

This module provides a set of exports to interact with the billing system.

You can use these exports from other resources with:

exports["crm-billing"]:functionName(args)

🔸getInvoiceById

Retrieve a single invoice by its ID.

local crm_invoice = exports["crm-billing"]:getInvoiceById(crm_id)

Parameters

  • crm_id (number) – Invoice ID.

Returns

  • (table | nil) – Invoice object if found, otherwise nil.

Example

local crm_invoice = exports["crm-billing"]:getInvoiceById(12)
if crm_invoice then
    print(("Invoice #%s amount: %s"):format(crm_invoice.crm_id, crm_invoice.crm_amount))
end

🔸getPlayerInvoices

Retrieve all invoices for a player.

Parameters

  • crm_identifier (string) – Character identifier.

Returns

  • (table | nil) – Table of player invoices if found, otherwise nil.

Example


🔸getSocietyInvoices

Retrieve all invoices for a society (job).

Parameters

  • crm_job (string) – Job name (e.g., "police", "mechanic").

Returns

  • (table | nil) – Table of society invoices if found, otherwise nil.

Example


🔸payInvoice

Pay an invoice if possible.

Parameters

  • crm_id (number) – Invoice ID.

Returns

  • (boolean)true if paid successfully, false otherwise.

Example


🔸cancelInvoice

Cancel an invoice.

Parameters

  • crm_id (number) – Invoice ID.

Returns

  • (boolean)true if invoice was cancelled, false if not found.

Example


🔸addPersonalInvoice

Create a new personal invoice.

Parameters

  • crm_sender (number) – Sender server ID (must be online).

  • crm_receiver (number) – Receiver server ID (must be online).

  • crm_amount (number) – Invoice amount.

  • crm_reason (string) – Invoice data. Example:

  • crm_cb (function | optional) – Callback function returning the created invoice.

Example


🔸addSocietyInvoice

Create a new society invoice.

Parameters

  • crm_data (table) – Invoice data. Example:

Returns

  • (table | false) – Invoice object if created, otherwise false.

Example


🔸addOfflineInvoice

Create a new offline invoice.

Parameters

  • crm_data (table) – Invoice data. Example:

Returns

  • (table | false) – Invoice object if created, otherwise false.

Example

Last updated