> For the complete documentation index, see [llms.txt](https://doc.var-fivem.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.var-fivem.com/coins-shop/configuration/delivery.md).

# Delivery

The delivery system is what gives the player their vehicle, weapon, skin, money or pack once a checkout is completed. It supports three layered customization mechanisms, from simplest to most flexible.

### Mechanism 1 — Weapon delivery mode

In `shared/config.lua`:

```lua
Delivery = {
  WeaponDeliveryMode = "native", -- "native" or "item"
}
```

| Mode       | Behavior                                                                                                                                                                  |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `"native"` | Uses `xPlayer.addWeapon` (ESX) or the QBCore native — the player gets the weapon directly.                                                                                |
| `"item"`   | Gives the weapon as an **inventory item** (ox\_inventory, qs-inventory, qb-inventory…). The IDs in `Products.Weapons` must match item names that exist in your inventory. |

### Mechanism 2 — Server hooks (recommended)

Hooks are the cleanest way to plug your own garage / inventory / money system without touching encrypted files. Edit `server/framework/hooks.lua`:

```lua
VarShop = VarShop or {}
VarShop.FrameworkOverrides = VarShop.FrameworkOverrides or {}

-- Vehicle delivery to your own garage table
function VarShop.FrameworkOverrides.giveVehicle(src, identifier, item)
  -- item = { id = "rebla", kind = "vehicle", qty = 1, meta = { upgrades = {...}, plate = "..." } }
  local plate = item.meta and item.meta.plate or ("VAR" .. math.random(10000, 99999))

  MySQL.insert.await([[
    INSERT INTO my_garage_table (citizenid, model, plate, garage)
    VALUES (?, ?, ?, ?)
  ]], { identifier, item.id, plate, "pillboxgarage" })

  return true -- true = handled, do not run default ESX/QB logic
end

-- Force a specific inventory for weapons
function VarShop.FrameworkOverrides.giveWeapon(src, identifier, item)
  exports['ox_inventory']:AddItem(src, item.id, item.qty or 1)
  return true
end

-- Items / skins
function VarShop.FrameworkOverrides.giveItem(src, identifier, item)
  exports['ox_inventory']:AddItem(src, item.id, item.qty or 1, item.meta)
  return true
end
```

{% hint style="info" %}
Return `true` to signal "I handled this delivery myself". Return `nil` (or nothing) to fall back to the default ESX/QB logic.
{% endhint %}

### Mechanism 3 — Handlers config

If you prefer routing specific kinds to **events** or **exports** without writing hook code:

```lua
Delivery = {
  Handlers = {
    vehicle = { Event = "myserver:giveVehicle" },          -- TriggerEvent(event, src, identifier, item)
    weapon  = { Export = "ox_inventory:AddItem" },         -- exports[res][func](src, identifier, item)
    skin    = { Type = "framework:item" },                 -- default behavior
    money   = { Event = "myserver:giveMoney" },
    pack    = { Type = "framework:pack" },                 -- recursively unpack contents
  },
  FallbackEvent = "var-shop:deliver:item", -- triggered when no handler matched
}
```

#### Available handler keys

| Key                          | Effect                                                             |
| ---------------------------- | ------------------------------------------------------------------ |
| `Type = "framework:vehicle"` | Inserts into ESX `owned_vehicles` or QB `player_vehicles`          |
| `Type = "framework:weapon"`  | Native `addWeapon` (mode native) or `addInventoryItem` (mode item) |
| `Type = "framework:item"`    | Native `addInventoryItem` of your framework                        |
| `Type = "framework:money"`   | Native `addMoney` of your framework                                |
| `Type = "framework:pack"`    | Unpacks `contents = { { kind = "vehicle", ref = "rebla" }, … }`    |
| `Event = "..."`              | `TriggerEvent(event, src, identifier, item)`                       |
| `Export = "resource:func"`   | `exports[resource][func](src, identifier, item)`                   |

### Garage table mapping

If your server doesn't follow the standard ESX (`owned_vehicles`) or QB (`player_vehicles`) schema, remap the columns in `shared/config.lua`:

```lua
Vehicle = {
  PlatePrefix = "VAR",          -- "" for no prefix
  ESXTable = "owned_vehicles",
  ESXOwnerColumn = "owner",
  ESXPlateColumn = "plate",
  ESXDataColumn = "vehicle",
  ESXStoredColumn = "stored",
  QBTable = "player_vehicles",
  QBOwnerColumn = "citizenid",
  QBPlateColumn = "plate",
  QBDataColumn = "mods",
  QBStateColumn = "state"
}
```

### Item shape received by handlers

```lua
-- Vehicle
{ id = "rebla", label = "Rebla GTS", kind = "vehicle", qty = 1,
  meta = { upgrades = { "perf", "plate" }, plate = "VAR12345" } }

-- Weapon
{ id = "WEAPON_AK4K", label = "AK-4K", kind = "weapon", qty = 1 }

-- Skin
{ id = "SKIN_WEAPON_NEVA", label = "Neva Glowing", kind = "skin", qty = 1,
  meta = { variant = "black", weaponFor = "WEAPON_NEVA" } }

-- Money
{ id = "money_cash", label = "Cash", kind = "money", qty = 1, amount = 5000 }

-- Pack (auto-unpacked by framework:pack)
{ id = "pack_explorer", label = "Explorer Pack", kind = "pack", qty = 1 }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.var-fivem.com/coins-shop/configuration/delivery.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
