# Checkout Conversion Flow (BAR-106)

Shipped April 30, 2026. PR #162.

## Flow Diagram

```mermaid
flowchart TD
    A[Landing Page] --> B[Sign Up / Login]
    B --> C{"/get-started" fork}

    C -->|Try a Free Essay| D[MEE Demo: Torts Essay]
    C -->|See Pricing| E[Pricing Page]

    D --> F[Scored Feedback + Results]
    F --> G{Student decides}
    G -->|Ready to buy| E
    G -->|Not yet| H[Leaves site]

    E --> I{Choose product}
    I -->|MEE $129| J[Checkout Page]
    I -->|Florida $129| J

    J --> K{Cursor moves to leave?}
    K -->|Yes, first time| L["SHEP20 Modal: $20 off"]
    K -->|No| M[Complete Purchase button]

    L -->|Use discount| N["Stripe Checkout at $109"]
    L -->|Dismiss| M
    M --> O["Stripe Checkout at $129"]

    N --> P[Payment Success]
    O --> P
    P --> Q[Dashboard - Full Access]

    J -->|Leaves without buying| R["checkout_viewed_at recorded"]
    R -->|24 hours pass| S["Abandoned Cart Email\n(SHEP20 code + demo link)"]
    S -->|Clicks 'Start Free Essay'| D
    S -->|Ignores| T[No further emails]

    H -->|24h, visited checkout| S

    style C fill:#f0f4ff,stroke:#2563eb,stroke-width:2px
    style L fill:#fef3c7,stroke:#d97706,stroke-width:2px
    style S fill:#fef3c7,stroke:#d97706,stroke-width:2px
    style P fill:#d1fae5,stroke:#059669,stroke-width:2px
    style Q fill:#d1fae5,stroke:#059669,stroke-width:2px
```

## Safety Nets

| Net | Trigger | Action |
|-----|---------|--------|
| 1. Demo first | Post-signup | Let student experience product before asking for money |
| 2. Exit-intent discount | Cursor leaves viewport on checkout | SHEP20 modal ($20 off, auto-applied) |
| 3. Abandoned cart email | 24h after checkout view, no purchase | One email with SHEP20 code + demo link |

## Key Details

- **Promo code:** SHEP20 ($20 off, one-time, Stripe promotion code)
- **Exit-intent:** Fires once per browser session (sessionStorage gate). Works for both authenticated and unauthenticated visitors. Supports both MEE and Florida checkout funnels.
- **Abandoned cart email:** Sent via Brevo. Only to authenticated users who viewed checkout. One email per user, ever. Reply-to goes to founder@shepbarprep.com. Runs hourly via Vercel Cron.
- **Get-started page:** Replaces the old onboarding page as the first post-signup landing. "Try a Free Essay" sets exam_type=MEE and goes to demo. "See Pricing" links to /pricing (shows both MEE and Florida).

## PostHog Events

| Event | When |
|-------|------|
| `get_started_viewed` | Student lands on fork page |
| `get_started_chose_demo` | Clicks "Try a Free Essay" |
| `get_started_chose_pricing` | Clicks "See Pricing" |
| `checkout_viewed` | Checkout page loads |
| `exit_intent_discount_shown` | SHEP20 modal appears |
| `exit_intent_discount_used` | Student clicks "Use Discount" |
| `abandoned_cart_email_sent` | Cron sends the 24h email |
| `purchase_completed` | Payment succeeds |
