Create bill

Export

exports["billing_ui"]:createBill(senderIdentifier, targetIdentifier, reason, amount, target, targetType)

Parameters

NameData TypeDescription

senderIdentifier

string

The identifier of the player who creates the invoice In QBCore it's the citizen ID

targetIdentifier

string

The identifier of the player who receives the invoice In QBCore it's the citizen ID

reason

string

The reason of the invoice

amount

integer

The amount of the invoice

target

string

Who will receive the payment of the invoice - If targetType it's player the target will be an identifier (or citizen ID in QBCore) - If targetType it's society the target will be for example society_police

targetType

string

player or society

Example

-- ESX example
RegisterCommand("sendInvoiceToOfflinePlayer", function(playerId, args)
    local senderIdentifier = ESX.GetPlayerFromId(playerId).identifier
    local targetIdentifier = args[1] -- Example 6833b871ee066492978077ef154480366a2374b
    local reason = args[2] -- Example "Speed limit exceeded"
    local amount = tonumber(args[3]) -- Example 5000
    local target = "society_police"
    local targetType = "society"
    
    exports["billing_ui"]:createBill(senderIdentifier, targetIdentifier, reason, amount, target, targetType)
end)

-- QBCore example
RegisterCommand("sendInvoiceToOfflinePlayer", function(playerId, args)
    local senderIdentifier = QBCore.Functions.GetPlayer(playerId).PlayerData.citizenid
    local targetIdentifier = args[1] -- Example GPI46753
    local reason = args[2] -- Example "Speed limit exceeded"
    local amount = tonumber(args[3]) -- Example 5000
    local target = "society_police"
    local targetType = "society"
    
    exports["billing_ui"]:createBill(senderIdentifier, targetIdentifier, reason, amount, target, targetType)
end)

Last updated