Billing System

The script includes a simple yet highly functional billing system, allowing businesses to send invoices to clients. Clients can choose their preferred payment method and decide when to pay. It's important to note that expired invoices will be automatically charged whenever the player receives money in their bank account.

Available Money Accounts

Players can choose a money account to use for paying their invoices, you can find the list in config/ billing.lua > Config.AvailableAccounts

If using the option Cash with ESX Framework, make sure to change the value to "money".

Adding new Products/Services to the list.

By default, the products and services listed under "Product" are pulled from the av_items table, using the items created by the business. However, if you want to include custom products or services—such as a list of fines for the Police job or medical treatments for the Ambulance job—you can easily add them manually as follows:

  • Go to business/client/editable/billing.lua, here you will find a function named getBillingItems(business).

  • This function receives the job name as argument, we will use it to retrieve our custom list.

  • For this EXAMPLE we are gonna show a list of custom fines for police job, we will pull the data from ps-mdt. And again, this is just an example, is on you to retrieve the data from your own script and process it.

Example using ps-mdt

  • ps-mdt doesn’t provide a native export to retrieve the list of fines, as all the data is stored directly in its config. To make it accessible, we need to create a custom export ourselves. To do this, open ps-mdt/client/main.lua and add the following code at the very end of the file:

exports("getFines", function()
    return Config and Config.PenalCode or false
end)
  • Now we have an export we can use to retrieve the needed data, go back to business/edutable/billing.lua and add the export.

  • We now have access to the list of fines in our code — all that’s left is to iterate through it to extract the data we need:

  • So far, we can access all fine data without any issues. However, the items table requires the following structure:

    • item: string (This is the product/service title)

    • price:number

  • This is how our final code will look like (for this EXAMPLE):

  • Now you can go to Billing tab > Send Bill and see the full list of fines :)

  • Make sure to use the correct Server ID from the player u want to receive the invoice, if the player is close to you (3 meters) you can click the player icon and the script will add the server id to the field automatically.

  • Once the player accepts the invoice, it will show in your panel.

  • Players can access their invoices by using the command /billing

Last updated