> For the complete documentation index, see [llms.txt](https://daddy-studios.gitbook.io/daddy-studios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daddy-studios.gitbook.io/daddy-studios-docs/scripts/daddy-marketplace/hooks.md).

# Config Hooks

Three functions in `config.lua` are meant to be filled in by you. They stay editable in both editions, so the escrow edition can be customised just as far as the open-source one.

## Config.CustomTarget — client

Runs once for every spawned marketplace NPC when `Config.TargetSystem = 'custom'`. Use it to register the interaction with any resource that is not ox\_target or qb-target.

```lua
Config.TargetSystem = 'custom'

Config.CustomTarget = function(ped, locationId, location, open)
    -- call open() when the player interacts
end
```

| Parameter    | Type     | Content                                                  |
| ------------ | -------- | -------------------------------------------------------- |
| `ped`        | entity   | The spawned NPC                                          |
| `locationId` | string   | Key from `Config.Locations`                              |
| `location`   | table    | The full location table (`label`, `coords`, `radius`, …) |
| `open`       | function | Call with no arguments to open the marketplace here      |

### sleepless\_interact

```lua
Config.CustomTarget = function(ped, locationId, location, open)
    exports.sleepless_interact:addLocalEntity({
        entity  = ped,
        options = {
            {
                label    = location.label,
                icon     = 'fa-store',
                distance = location.radius or 2.0,
                onSelect = open,
            },
        },
    })
end
```

### A plain keybind zone

```lua
Config.CustomTarget = function(ped, locationId, location, open)
    exports.your_zones:CreateZone(location.coords, location.radius or 2.0, {
        onPress = open,
    })
end
```

{% hint style="warning" %}
`open` is already bound to the right location — call it directly, do not pass arguments. Do not call it on your own from a timer or a command; it is meant to run on a player interaction.
{% endhint %}

## Config.Notify.custom — server

Runs for every marketplace notification when `Config.Notify.type = 'custom'`, so you can route messages through your own notification resource.

```lua
Config.Notify = {
    type = 'custom',
    custom = function(source, message, notifyType, duration)
        TriggerClientEvent('your_notify:show', source, message, notifyType, duration)
    end,
}
```

`notifyType` is one of `success`, `error`, `info`, `warning`. `duration` is in milliseconds.

## Config.OnFeeCollected — server

Runs whenever the marketplace keeps money as a fee. By default the money leaves the economy; fill this in to move it into a society or government account instead.

```lua
Config.OnFeeCollected = function(amount, feeType)
    exports['qb-banking']:AddMoney('government', amount, 'marketplace-' .. feeType)
end
```

| `feeType`     | Source                                                     |
| ------------- | ---------------------------------------------------------- |
| `'sale'`      | `Config.Marketplace.taxPercentage` and `listingFeePercent` |
| `'buy_order'` | `Config.BuyOrders.taxPercentage` on creation               |
| `'featured'`  | Featured purchases and renewals                            |

### Split by type

```lua
Config.OnFeeCollected = function(amount, feeType)
    if feeType == 'featured' then
        exports['qb-banking']:AddMoney('marketing', amount, 'featured listing')
    else
        exports['qb-banking']:AddMoney('government', amount, 'market tax')
    end
end
```

### ESX society

```lua
Config.OnFeeCollected = function(amount, feeType)
    TriggerEvent('esx_addonaccount:getSharedAccount', 'society_government', function(account)
        if account then account.addMoney(amount) end
    end)
end
```

{% hint style="warning" %}
`amount` is always a positive whole number. Keep this function simple: an error thrown here does not roll back the trade that produced the fee, it just loses the transfer.
{% endhint %}

## Next steps

* [Fees & Taxes](/daddy-studios-docs/scripts/daddy-marketplace/configuration/fees.md)
* [Exports](/daddy-studios-docs/scripts/daddy-marketplace/exports.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://daddy-studios.gitbook.io/daddy-studios-docs/scripts/daddy-marketplace/hooks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
