Horizon Development
WebstoreDiscord
  • 🏠Home
  • 📖General Knowledge Base
    • 🛒Purchase
    • 🔑Tebex Escrow System
    • 🔧Support
  • 🛒Products
    • 🚢Horizon Yacht Robbery
    • 🛒Horizon Stores
    • 💰Horizon Bank Robbery
    • 🏡Horizon Burglary
    • 🚗Horizon Convoy Attack
    • 🕛Horizon Speedometer
    • 🔑Horizon Vehicle Lock
    • 💻Horizon Admin Menu
    • 🖥️Horizon HUD
    • 💻Horizon Pause Menu
    • 💳Horizon Payment System
  • Other
    • ❓FAQ
    • ❌Common errors
Powered by GitBook
On this page
  • Purchase
  • Preview
  • Installation
  • Requirements
  • Integration into other resources
  • Export on the client side
  • Export on the server side
  • Integration example (qb-vehicleshop)
  • Changelog
  • Update 1.1
  • Common Errors
  1. Products

Horizon Payment System

PreviousHorizon Pause MenuNextFAQ

Last updated 9 months ago

Purchase

Click to purchase the script.

Preview

Click to watch the preview video.

Installation

  1. 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

  • ESX Legacy/QBCore

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)

Horizon Payment System will not calculate the total amount of the payment from the subtotal of each item, nor will it calculate the subtotal of each item based on the number of items. These calculations must be done separately.

The specified onSuccess / onFail event will be interpreted as a client-side event if the export is triggered on the client side and as a server-side event if the export is triggered on the server side.

This behaviour can be overridden by specifying the value of "side" in the table containing the onSuccess / onFail event.

Example:

{
    event = "EVENT_NAME", args = {}, side = "client"
}

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

🛒
💳
here
here
Download
bzzz_terminal