# Configuration

Coins shop with Tebex top-ups, gifts, loyalty, rotations, owner tools, ESX/QBCore/standalone support, and ready-made web UI.

### Tebex HTTP endpoint

* Path: `POST /varshop/tebex`
* Body: JSON `{ secret, identifier|player, coins|amount|value, reference/transaction }`
* Checks the secret, resolves identifier, credits coins, syncs player if online, returns `{ ok, identifier, balance }`.

### Delivering items (overview)

* Default handlers cover ESX/QBCore for vehicles, weapons, items, money, packs.
* To change behaviour:
  * Configure `Delivery.Handlers` to point a `kind` to your own event/export.
  * Or use Framework hooks (see below) to override `giveVehicle`, `giveWeapon`, `giveItem`, `giveMoney`, `giveVehicle` etc.
* Fallback event (`Delivery.FallbackEvent`) fires when nothing handled the item.

### Exports (server/exports.lua)

* `AddCoins(identifier, amount, context?)`: credit coins.
* `RemoveCoins(identifier, amount, context?)`: remove coins.
* `GetCoins(identifier)`: current balance.
* `GetAccount(identifier)`: ensures and returns account row.
* `RefreshPlayer(playerId)`: re-sync NUI payload for an online player.
* `RegisterSubscriptionPlans(plans)`: register plans (if subscription module present).
* `GetSubscriptionState(identifier)`: current subscription state.

### Framework hooks (server/framework/hooks.lua)

Override core behaviours without touching protected files:

* `resolveIdentifier(source)`: return identifier; `nil` to use default resolution.
* `resolveIdentifierInput(input)`: custom parsing for commands/webhooks.
* `giveVehicle(src, identifier, item)`, `giveWeapon`, `giveItem`, `giveMoney`: return `true/false` if you handled delivery; `nil` to let built-in logic run.
* These hooks run before the rest of the shop logic and are escrow-ignored.

### Usage

* Open shop: `/shop` (or your command), keybind `F4` by default.
* Test drive: available in UI if `TestDrive.Enabled`.
* Add coins: console `varshop:addcoins <identifier|serverId> <amount>` (console/Tebex only).
* Owner tools: allowed identifiers manage promos, stock, rotations, maintenance, spotlight, announcements, theme, webhook directly in UI.
