> For the complete documentation index, see [llms.txt](https://docs.ragnasync.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ragnasync.com/event-logs/economy/vending-log.md).

# Vending Logs

Logs player-to-player vending transactions to Discord

The Vending Log feature tracks player-to-player shop transactions. When someone buys items from a merchant's vending shop, the details are logged to Discord.

## Action

`vending_log`

## When It's Used

This log is triggered when:

* A player **purchases items** from another player's vending shop
* The transaction completes successfully

All items purchased in a single transaction are batched together.

## Why Use It

* **Track your server's player economy** in real-time
* **Monitor high-value trades** for potential scams
* **Celebrate big sales** in your community
* **Audit suspicious transactions** between accounts
* **Understand market prices** for popular items

## Server Configuration

In `conf/channels.conf`:

```
// Player vending transaction logging
ragnasync_vending_log_enabled: true
ragnasync_vending_log_channel_id: "YOUR_CHANNEL_ID"
ragnasync_vending_log_min_zeny: 100000
ragnasync_vending_log_group_min: 0
ragnasync_vending_log_group_max: 99
```

| Setting      | Description                                 | Default |
| ------------ | ------------------------------------------- | ------- |
| `enabled`    | Enable/disable vending logging              | `false` |
| `channel_id` | Discord channel ID for vending logs         | -       |
| `min_zeny`   | Minimum zeny threshold to log (0 = log all) | `0`     |
| `group_min`  | Minimum GM group level to log               | `0`     |
| `group_max`  | Maximum GM group level to log               | `99`    |

**Note:** This setting also controls `vending_item` messages when players open shops.

## Message Format

The default message shows buyer, seller, items, and prices including tax:

```
🏪 Vending:       | Buyer        -> Merchant     | Red Potion           x10    | 20,000z (tax 2,000z)
🏪 Vending:       | Buyer        -> Merchant     | Blue Potion          x5     | 50,000z (tax 5,000z)
```

## Data Fields

| Field               | Type   | Description                          |
| ------------------- | ------ | ------------------------------------ |
| `buyer_name`        | string | Character name of the buyer          |
| `seller_name`       | string | Character name of the seller         |
| `list`              | string | Batched item data (see format below) |
| `pos`               | string | Shop location: \`map                 |
| `buyer_account_id`  | int    | Buyer's account ID                   |
| `buyer_char_id`     | int    | Buyer's character ID                 |
| `seller_account_id` | int    | Seller's account ID                  |
| `seller_char_id`    | int    | Seller's character ID                |
| `channel`           | string | Discord channel ID                   |

### List Format

Items are sent as a comma-separated list with pipe-delimited values:

```
item_id|item_name|amount|price|tax,item_id|item_name|amount|price|tax,...
```

**Example:**

```
512|Apple|10|20000|2000,513|Banana|5|50000|5000
```

## Example Use Cases

### Public Trading Channel

Let everyone see what's being traded on your server:

```
ragnasync_vending_log_channel_id: "1234567890"  // #marketplace
```

### Monitor High-Value Trades

Watch for expensive items changing hands to prevent scams.

### Track Economy Health

See what items players are actually buying and at what prices.

### Celebrate Big Sales

When someone sells an MVP card, the whole community can see it!

## Custom Messages

Want to customize how these messages look? Head to the **Message Routes** page on your dashboard, set the format to **Custom Message**, and compose your own template using `{{placeholder}}` syntax.

**Example template:**

```
:moneybag: {{buyer_name}} bought items from {{seller_name}}!
```

**Available placeholders for this event:**

| Placeholder       | Example |
| ----------------- | ------- |
| `{{buyer_name}}`  | Marky   |
| `{{seller_name}}` | Vendor  |

See [Message Routing](/ragnascript/message-routing.md) for more about formats, conditions, and multi-channel routing.

## Notes

* Both buyer and seller information is tracked
* Tax amount is calculated based on your server's vending tax rate
* Position shows where the merchant's shop was located
* All items from a single purchase are grouped together
* Use alongside Vending Items to see complete shop activity
