[ESX - ENG/DE] myBills - Billing with Partial Payment, Bill Requests and Discord Webhooks

Hey guys,

today I want to present my billing system which provides some special features, which are extremely useful - especially for roleplay servers.

Features:

  • When you issue an invoice the other player have to accept the invoice. This also avoids that players receive invoices just “for fun”.
  • When a player doesn’t pay his bills, they are automatically and partly paid every night. There is also a menu included, so the player can view his partly paid invoices. Also he can pay the remaining amount through this menu
  • Every player have the opportunity to issue an invoice (can be disabled in the Config)
  • No need to change your scripts: I’ve left the sendBill event completely like it was in ESX, so you just have to turn off esx_bills to make this work.
  • As always full translation and config file.

Showcase Video:

Main menu:
main

Confirmation menu:
receivemenu

Part payment menu:
partpay
You can set up a time, when the bills should be partly paid. For testing you can also use the command /paytaxbills in the server console.

Discord Notifications:
You can set up notifications for societies in the Config.lua. When you use this, there will be notifications when a player issues a society invoice:


Of course you can set up this for all societies (companies), which for example want to broadcast this on their discord.

Configuration is super easy:
1.) Create new Discord webhook
2.) Set up your webhook in the Config.lua

Config.useDiscordWebhooks = true
Config.Webhooks = {
    ['society_police'] = GetConvar("webhook_police_invoice", "Failed to load webhook error!"),
    ['society_example'] = GetConvar("webhook_example", "Failed to load webhook error!"),
}

To add Convars, you can just add

set webhook_example "https://discordapp.com/api/webhooks/........" <- your webhook link

to your server.cfg.
3.) Finished, when an employee of society_example issues an invoice (also with his job menu) there will be a Discord notify.

Language config:
German and English are already set up.

Translations
Translation = {

    ['de'] = {
        ['bills'] = 'Rechnungen',
        ['give_bill'] = 'Rechnung ausstellen',
        ['give_bill_desc'] = 'Stelle eine Rechnung aus',
        ['reason'] = 'Grund:',
        ['insert_reason'] = 'Gebe einen Grund ein',
        ['amount'] = 'Betrag:',
        ['insert_amount'] = 'Betrag eingeben',
        ['submit_bill'] = '~g~Rechnung ausstellen',
        ['taxbills'] = 'Rechnungen in Teilzahlung',
        ['taxbills_desc'] = '~r~Offener Betrag ~s~/ ~o~Gesamt',
        ['private'] = 'Privat',

        ['dialog_title'] = 'Rechnung erhalten',
        ['dialog_accept'] = '~g~Rechnung annehmen',
        ['dialog_reject'] = '~r~Rechnung ablehnen',

        ['bill_paid'] = '~g~Die Rechnung i.H.v. ~w~',
        ['bill_paid2'] = '$ ~g~wurde bezahlt.',
        ['society_bill_paid'] = '~g~Eine von dir ausgestellte Rechnung i.H.v. ~w~',
        ['society_bill_paid2'] = '$ ~g~wurde bezahlt.',

        ['not_enough_money'] = '~r~Du hast nicht genügend Geld!',
        ['bill_given'] = '~g~Anfrage für die Rechnung weitergegeben.',
        ['bill_accepted'] = '~g~Deine Rechnung wurde akzeptiert.',
        ['target_bill_accepted'] = '~g~Du hast die Rechnung akzeptiert.',
        ['bill_rejected'] = '~r~Deine Rechnung wurde abgelehnt.',
        ['target_bill_rejected'] = '~r~Du hast die Rechnung abgelehnt.',

        ['discord_new_invoice'] = 'Neue Rechnung',
        ['discord_msg'] = ' hat ',
        ['discord_msg2'] = ' eine Rechnung i.H.v. ',
        ['discord_msg3'] = '$ für ',
        ['discord_msg4'] = ' ausgestellt.',

        ['paid_taxbill'] = 'Ein Teil deiner Rechnungen wurde ~g~bezahlt~s~ : ~g~$',
    },

    ['en'] = {
        ['bills'] = 'Bills',
        ['give_bill'] = 'Issue an invoice',
        ['give_bill_desc'] = 'Issue an invoice to somebody',
        ['reason'] = 'Reason:',
        ['insert_reason'] = 'Enter a reason',
        ['amount'] = 'Amount:',
        ['insert_amount'] = 'Enter an amount',
        ['submit_bill'] = '~g~Confirm',
        ['taxbills'] = 'Part payment invoices',
        ['taxbills_desc'] = '~r~Remaining amount ~s~/ ~o~Total',
        ['private'] = 'Privat',

        ['dialog_title'] = 'Received invoice',
        ['dialog_accept'] = '~g~Accept',
        ['dialog_reject'] = '~r~Reject',

        ['bill_paid'] = '~g~The bill of ~w~',
        ['bill_paid2'] = '$ ~g~was paid.',
        ['society_bill_paid'] = '~g~One of your bills of ~w~',
        ['society_bill_paid2'] = '$ ~g~was paid.',

        ['not_enough_money'] = '~r~You do not have enough money!',
        ['bill_given'] = '~g~Request sent for the invoice.',
        ['bill_accepted'] = '~g~Your bill was accepted.',
        ['target_bill_accepted'] = '~g~You have accepted the bill.',
        ['bill_rejected'] = '~r~Your bill was rejected.',
        ['target_bill_rejected'] = '~r~You have rejected the bill.',

        ['discord_new_invoice'] = 'New invoice',
        ['discord_msg'] = ' has given ',
        ['discord_msg2'] = ' a bill with an amount of ',
        ['discord_msg3'] = '$ for ',
        ['discord_msg4'] = '.',

        ['paid_taxbill'] = 'A part of your remaining invoices was ~g~paid~s~ : ~g~$',
    }
}

Dependencies:

  • ESX
  • NativeUI
  • cron

Price: 3,90€ / 4,80$ (tax included)
Download at https://luis-scripts.tebex.io/package/4238312

There is an optional EnhancedUI avalable for myBilling: You can get further information here: EnhancedUI for myBilling

Important note: If you’re currently using esx_billing, you can change without any effort to this script:
You only have to import the new .sql file for the partial payment. All open invoices and events are still working.

7 Likes

Does this have an autopayment feature? We are using tax system, and really need such solution, so crossing my fingers :slight_smile:

Hey!
What do you mean with autopayment function?
The script includes a function that all open bills are partly paid at a certain time.

So I get tax invoice, from car and house every 15 minutes, I just wanted to know if its possible this will go to autopayment, and then this system is for the rest of paymants nessasary

Hey,
When you don‘t manage the tax invoices through esx_billing right now, this won‘t be effected by this script.
When I understood you right, I would say the script does, what you want.

Hello dude @Luiiis . I just purshared your script coz this is exactly what i’m shearch !

So, if i understand, i can comment my esx_billing of my server.cfg and just start your script right ? Or he need to work togather ?

Thank again dude ! And i can give you a french trad if you want =)

Hey,

you can completely disable esx_billing. You don’t need this anymore. The only thing, which is important, is to remove esx_billing also from other script dependencies (if there are some).

Helli Luiiis i see you deveoping good scripts but i have a bug i become more billings at 30 min like 4 billings and this is staking over and over i use esx_tax can you fix it that he schow me more billings under a billing not like this the amout is also buggy

Hey,

instead of the esx_billing event you can trigger my event here:

TriggerServerEvent('myBills:gotAnswerForBill', sender, playerIdentifier, target, label, price, true)

sender: Should be the source of the player who sends the invoice (in this case can be the one who get the invoice)
playerIdentifier: The identifier of the player, who should get an invoice
target: Is the one, who gets the money. You can set this to society_police for example. If you set this to nil, the sender will be the target.
label: Title of the invoice
price: i guess it’s clear

if i trigger you event in myBilling ore do i need to trigger it in esx_tax

In esx_tax

You mean in the fxxmanifest or resource ?

If esx_billing is still in the fxmanifest or Ressource.lua (f.e. as dependency) you have to remove it from there.

All in all this event can be used if you want to send direct invoices without requests.

1 Like

He work perfectly ! Thank you a lot dude ! And it’s a very ship upgrade for your server !

1 Like

if i do this i become a error

InvokeNative: execution failed: Argument at index 1 was null.
SCRIPT ERROR: Execution of native 000000002f7a49e6 in script host failed: Argument at index 1 was null.

my code is here clientside

ESX              = nil
local PlayerData = {}

Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getShKaraaredObjKaraect', function(obj) ESX = obj end)
		Citizen.Wait(0)
  end
end)

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
  PlayerData = xPlayer   
end)

RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
  PlayerData.job = job
end)

RegisterNetEvent('tax:sendTax')
AddEventHandler('tax:sendTax', function(source, type, amount)
  --TriggerServerEvent('esx_biKaralling:sendBill', source, Config.SocietyAccount, type, amount)
  TriggerServerEvent('myBills:gotAnswerForBill', sender, playerIdentifier, target, label, price, true)
end)

You have to replace the placeholders with your variables

can you dm me

your trigger event opens the menu to accept ore deny i just want to see my automaticle create bills in the list not to accept ore deny

I‘ve answered your DM. There I‘ll send you instructions.

1 Like

Hey dude ! I want to add a notification to the sender when a bill of society (source) was paied.

Actually, i just have the “accept” notification but no the “pay” notification