πŸ’³Horizon Payment System

Purchase

Click here to purchase the script.

Preview

Click here to watch the preview video.

Installation

  1. Download and drop the bzzz_terminal folder into your server resources folder.

  2. Drop the horizon_paymentsystem folder into your server resources folder.

  3. Add these lines to your server.cfg:

    start bzzz_terminal

    start horizon_paymentsystem

  4. Configure the script if needed.

  5. Restart your server.

Requirements

Integration into other resources

Horizon Payment System allows easy integration of payment via terminal into other resources such as a shop, car dealership or any other script.

Export on the client side

exports["horizon_paymentSystem"]:startPayment(
    "SELLER NAME", -- Seller name (e.g. 24/7 Store, Premium Deluxe Motorsport)
    PAYMENT AMOUNT, -- Total amount of the payment
    { -- List of items that will appear on the receipt (could be nil)
        {item = "ITEM NAME #1", price = TOTAL PRICE, amount = AMOUNT} -- "amount" could be nil
        {item = "ITEM NAME #2", price = TOTAL PRICE, amount = AMOUNT} -- "amount" could be nil
    },
    { -- OnSuccess event, triggered by successful payment
        event = "EVENT_NAME", args = {ARG1 = "ARGUMENT #1", ARG2 = "ARGUMENT #2"}
    },
    { -- OnFail event, triggered by unsuccessful payment
        event = "EVENT_NAME", args = {ARG1 = "ARGUMENT #1", ARG2 = "ARGUMENT #2"}
    }
)

Export on the server side

exports["horizon_paymentSystem"]:startPayment(
    PLAYER, -- Player id who receives the payment request
    "SELLER NAME", -- Seller name (e.g. 24/7 Store, Premium Deluxe Motorsport)
    PAYMENT AMOUNT, -- Total amount of the payment
    { -- List of items that will appear on the receipt (could be nil)
        {item = "ITEM NAME #1", price = TOTAL PRICE, amount = AMOUNT} -- "amount" could be nil
        {item = "ITEM NAME #2", price = TOTAL PRICE, amount = AMOUNT} -- "amount" could be nil
    },
    { -- OnSuccess event, triggered by successful payment (could be nil)
        event = "EVENT_NAME", args = {ARG1 = "ARGUMENT #1", ARG2 = "ARGUMENT #2"}
    },
    { -- OnFail event, triggered by unsuccessful payment (could be nil)
        event = "EVENT_NAME", args = {ARG1 = "ARGUMENT #1", ARG2 = "ARGUMENT #2"}
    }
)

Integration example (qb-vehicleshop)

server.lua
RegisterNetEvent('qb-vehicleshop:server:buyShowroomVehicle', function(vehicle)
    local src = source
    vehicle = vehicle.buyVehicle
    local pData = QBCore.Functions.GetPlayer(src)
    local cid = pData.PlayerData.citizenid
    local cash = pData.PlayerData.money['cash']
    local bank = pData.PlayerData.money['bank']
    local vehiclePrice = QBCore.Shared.Vehicles[vehicle]['price']
    local plate = GeneratePlate()
    if cash > tonumber(vehiclePrice) then
        MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
            pData.PlayerData.license,
            cid,
            vehicle,
            GetHashKey(vehicle),
            '{}',
            plate,
            'pillboxgarage',
            0
        })
        TriggerClientEvent('QBCore:Notify', src, Lang:t('success.purchased'), 'success')
        TriggerClientEvent('qb-vehicleshop:client:buyShowroomVehicle', src, vehicle, plate)
        pData.Functions.RemoveMoney('cash', vehiclePrice, 'vehicle-bought-in-showroom')
    elseif bank > tonumber(vehiclePrice) then
        exports["horizon_paymentSystem"]:startPayment(
            src,
            "Premium Deluxe Motorsport",
            tonumber(vehiclePrice),
            {
                {
                    item = string.upper(vehicle).." (Plate: "..plate..")",
                    price = tonumber(vehiclePrice)
                }
            }, 
            {    
                event = "qb-vehicleshop:server:vehiclePurchaseSuccess",
                args = {
                    license = pData.PlayerData.license,
                    cid = cid,
                    vehicle = vehicle,
                    plate = plate
                }
            }
        )
    else
        TriggerClientEvent('QBCore:Notify', src, Lang:t('error.notenoughmoney'), 'error')
    end
end)

RegisterNetEvent("qb-vehicleshop:server:vehiclePurchaseSuccess", function(data)
    local src = source
    MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
        data.license,
        data.cid,
        data.vehicle,
        GetHashKey(data.vehicle),
        '{}',
        data.plate,
        'pillboxgarage',
        0
    })
    TriggerClientEvent('QBCore:Notify', src, Lang:t('success.purchased'), 'success')
    TriggerClientEvent('qb-vehicleshop:client:buyShowroomVehicle', src, data.vehicle, data.plate)
end)

Changelog

Update 1.1

  • Fixed a bug that prevented players from receiving the requested amount to their personal account after a successful payment on ESX systems

  • Fixed a bug that in some cases prevented the society account from receiving the requested amount after a successful payment on ESX systems

  • Fixed a bug that in some cases prevented the PIN code of the players from being generated

  • Fixed several bugs that caused some functions to fail in some cases

  • Fixed a broken link in the README file for the product

Common Errors

Last updated