> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roomdropapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Order Lifecycle

> How a drop moves through RoomDrop's system from start to finish.

## States

Every drop in RoomDrop follows a defined lifecycle:

```
waiting_for_runner
       │
       ▼
  runner_accepted
       │
       ▼
   picked_up
       │
       ▼
   delivered
       │
       ▼
tip_window_open  (5-minute window)
       │
       ▼
   completed
```

### Cancelled states

At any point before pickup, a drop may enter a cancelled state:

* `cancelled_no_runner` — no runner accepted within the window
* `cancelled_by_runner` — runner cancelled after accepting
* `cancelled_by_customer` — customer cancelled before runner acceptance

## Tip window

After a drop is marked delivered, a 5-minute tip window opens. During this window:

* The customer can select a tip ($1, $2, or \$3)
* The RoomDrop backend holds the payment open

When the window closes (or the customer selects a tip), the payment is captured for the exact amount owed. If no tip is selected, only the \$3.99 drop fee is captured.

## Payment flow

1. **Authorization** — When the customer starts an order session, RoomDrop creates a Stripe PaymentIntent with manual capture for up to \$6.99
2. **Capture** — After the tip window closes, the PaymentIntent is captured for the actual amount
3. **Runner payout** — Payouts to runners are queued and processed through Stripe Connect Express

## Real-time chat

Once a runner accepts, a live chat channel opens between the customer and runner. Messages are stored in Firebase Realtime Database and delivered in real time through the iOS app. Chat history is purged after a set period.
