> For the complete documentation index, see [llms.txt](https://docs.sourcedev.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sourcedev.pro/advanced-billing-system/installation.md).

# Installation

## Prerequisites

Before installing the Billing System, ensure you have:

* ✅ A working FiveM server
* ✅ One of the supported frameworks (QBox, QBCore, or ESX)
* ✅ MySQL/MariaDB database
* ✅ Basic knowledge of FiveM resource installation

## Step 1: Download

Download the latest version of `src-billing` from your source.

## Step 2: Extract Files

Extract the `src-billing` folder to your server's `resources` directory:

```
server/
└── resources/
    └── [SRC]/
        └── src-billing/
```

## Step 3: Database Setup

### Import SQL File

Execute the SQL file to create the required database tables:

1. Open your database management tool (HeidiSQL, phpMyAdmin, etc.)
2. Select your FiveM database
3. Import the file: `src-billing/sql/billing.sql`

### Verify Tables

After importing, verify these tables exist:

* `billing_invoices` - Stores all invoices
* `billing_cashbox` - Stores cashbox balances per job
* `billing_menus` - Stores customizable billing menus

## Step 4: Configuration

### Basic Configuration

Edit `config.lua` to match your server:

```lua
Config.Framework = 'auto'  -- 'qbox', 'qb', 'esx', or 'auto'
Config.AllowedJobs = {
    'police',
    'ambulance',
    'mechanic',
    -- Add your jobs here
}
Config.Keybind = 'F7'  -- Tablet open key
```

### Framework Configuration

If auto-detection doesn't work, manually set your framework:

```lua
-- For QBox
Config.Framework = 'qbox'

-- For QBCore
Config.Framework = 'qb'

-- For ESX
Config.Framework = 'esx'

-- For Custom Framework
Config.Framework = 'custom'
-- Then configure bridge functions (see Framework Bridge section)
```

## Step 5: Add to server.cfg

Add the resource to your `server.cfg`:

```cfg
ensure src-billing
```

{% hint style="info" %}
Make sure to start `src-billing` **after** your framework resource.
{% endhint %}

## Step 6: Restart Server

Restart your FiveM server or start the resource:

```
restart src-billing
```

## Step 7: Verify Installation

### Check Console

Look for this message in your server console:

```
[Billing Bridge] Framework auto-detected: qbox
[src-billing] Resource started successfully
```

### Test In-Game

1. Join your server
2. Get a job from `Config.AllowedJobs`
3. Press `F7` (or your configured key)
4. Tablet should open

## Troubleshooting Installation

### Resource Won't Start

**Check:**

* Resource is in correct folder
* `fxmanifest.lua` exists
* No syntax errors in config

**Solution:**

```
restart src-billing
```

### Database Errors

**Check:**

* SQL file was imported correctly
* Database connection is working
* Tables exist in database

**Solution:** Re-import `sql/billing.sql`

### Framework Not Detected

**Check:**

* Framework resource is started
* Framework name is correct in config

**Solution:**

```lua
Config.Framework = 'qbox'  -- Set manually
```

### Tablet Won't Open

**Check:**

* You have an allowed job
* Keybind is correct
* No console errors

**Solution:** Check [Troubleshooting Guide](https://github.com/dollar-src/docs/blob/main/billing/gitbook-troubleshooting.md)

## Next Steps

{% content-ref url="<https://github.com/dollar-src/docs/blob/main/billing/gitbook-configuration.md>" %}
<https://github.com/dollar-src/docs/blob/main/billing/gitbook-configuration.md>
{% endcontent-ref %}

{% content-ref url="<https://github.com/dollar-src/docs/blob/main/billing/gitbook-user-guide.md>" %}
<https://github.com/dollar-src/docs/blob/main/billing/gitbook-user-guide.md>
{% endcontent-ref %}

## Optional Dependencies

### ox\_lib (Recommended)

For enhanced notifications:

```cfg
ensure ox_lib
ensure src-billing
```

### ox\_inventory

For receipt printing feature:

```cfg
ensure ox_inventory
ensure src-billing
```

{% hint style="success" %}
Installation complete! You're ready to start using the Billing System.
{% endhint %}
