> For the complete documentation index, see [llms.txt](https://docs.wynta.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wynta.com/bonus/flows/wager-release.md).

# Wager-Based Chunk Release

## Flow — events & wagering release chunks (PAM → Wynta → PAM)

Chunks move `PENDING → RELEASE` through two configured mechanisms (see [Bonus Lifecycle & Chunk Model](/bonus/architecture/lifecycle-and-chunks.md) for the algorithm):

1. **Release trigger events** — any [PAM event](/bonus/api-reference/bonus-events.md) mapped to a `bonus_release_trigger.trigger_type` (`DEPOSIT`, `LOGIN`, `BET_PLACED`, `TOURNAMENT_WON`, …) whose conditions pass.
2. **Wagering progress** — when `wager_multiplier > 0`, **`bet_placed` events feed the per-chunk wagering progress** (`chunk.wager_amount`); a chunk releases when its progress reaches `chunk_amount × wager_multiplier`.

**Trigger:** the player wagers; the PAM emits `bet_placed` with the standard event envelope:

```json
{
  "event_id": "a1b2c3d4-0000-0000-0000-000000000050",
  "event_name": "bet_placed",
  "user_id": "user_001",
  "session_id": "sess_abc123",
  "timestamp": "2026-05-14T19:00:00.000Z",
  "properties": {
    "wager_amount": "250.0000",
    "game_id": "book_of_frosty",
    "game_category": "slots",
    "game_provider": "pragmatic",
    "balance_type": "bonus"
  }
}
```

**Mechanism:**

1. Wynta filters events to the bonus's `wager_chip_type` and evaluates any `BET_PLACED`-type release triggers (amount band, `product`, `occurrence`, …).
2. Qualifying `wager_amount` accrues to the current chunk's `wager_amount` progress (serialized per player-bonus — no double counting).
3. Each chunk whose requirement is met moves to `RELEASE`; overflow progress carries into the next `PENDING` chunk.
4. Per released chunk (or batch), Wynta writes a `released` ledger entry and fires the **`BONUS_RELEASED`** webhook; **the PAM updates its client wallet** — chunk amount moves **Pending → Available**.

**Edge rules:**

| Case                                           | Behaviour                                                                                  |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------ |
| Large wager crosses several chunk requirements | Multiple chunks release at once; webhook may batch via `chunks[]`                          |
| Voided wager                                   | Progress reduced; **released chunks are never clawed back**                                |
| `wager_multiplier = 0`                         | No wagering requirement — chunks release on trigger conditions alone                       |
| Wynta unavailable                              | PAM buffers/replays events (deduped on envelope `event_id`); release evaluation catches up |

## Wagering progress display

`GET /api/v1/user-bonuses/{user_id}/summary` returns `wagering_required` — the remaining wager amount needed to release **all** pending chunks — per chip type. The PAM can render a progress bar directly from this field ("₹400 more wagering unlocks your next ₹166.67"), with per-chunk progress (`chunks[].wager_amount`) available from the transaction-detail endpoint.

## Sequence

```
PAM (Client) — external client                    Wynta Bonus
   │  bet_placed {wager_amount: "250.0000",       │
   │    balance_type: "bonus", event_id}          │
   │─────────────────────────────────────────────▶│ chunk#2 progress 350 → 600
   │                                              │ requirement 500 met
   │◀── webhook BONUS_RELEASED ───────────────────│ chunk#2: PENDING → RELEASE
   │    {chunk_ref: "CHUNK_002",                  │ overflow 100 → chunk#3
   │     amount: "166.67",                        │
   │     pending_delta: "-166.67",                │
   │     available_delta: "166.67"}               │
   │  client wallet: Pending → Available          │
```
