> For the complete documentation index, see [llms.txt](https://tyrix.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tyrix.gitbook.io/docs/script-resources/tyrix-business/cash-register.md).

# Cash Register

The register feature is a placeable target zone that lets a worker charge a nearby customer. The customer sees a payment prompt with an optional tip field.

## Money flow

* **Base charge** follows `Config.Registers.businessCommission` - default **30% to the business society account, 70% to the worker**.
* **Per-register override** - set a custom commission % when placing or editing a register from the Business Manager. Leave blank to fall back to the Config default. The rate is resolved server-side at charge time, so a modded client can't spoof it.
* **Tips go 100% to the worker** as cash, on top of the commission split.

## Worker flow

1. Approach the register's target zone; interact.
2. Pick a customer from the nearby-player list (radius: `Config.Registers.nearbyPlayerDistance`, default 5 m).
3. Enter the amount. The number field is comma-formatted for readability.
4. Confirm - the customer receives the payment prompt.

## Customer flow

1. Prompt shows the amount, the business, and a tip field (optional).
2. Customer either pays (amount + tip) or declines.
3. On pay: money moves atomically. Society + worker are both credited before the customer sees "paid".
4. On decline / timeout: the pending charge is dropped.

## Server-side guarantees

* **Pending charges are server-only** - tracked in a `pendingPayments` map keyed by customer ID; cleared atomically on first response.
* **Tip is clamped** to a non-negative integer ≤ 10 000 000. Client-supplied floats or negative numbers are rejected.
* **Funds check runs against `amount + tip`** - insufficient funds rejects the entire transaction. No partial debit.
* **5-minute timeout** on pending charges - a customer who wanders off doesn't leave a dangling row.
* **Business identity comes from the register**, not the client - the customer's prompt can't be re-targeted to a different business.

## Config

```lua
Config.Registers = {
    nearbyPlayerDistance = 5.0,
    businessCommission   = 0.30,  -- 30% base to society, 70% to worker; tips 100% to worker
}
```
