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

# UJ-M-008: Purchase Event Ticket

> Member completes event registration and ticket purchase with payment

## Journey Overview

| Attribute      | Value                                                     |
| -------------- | --------------------------------------------------------- |
| **Journey ID** | UJ-M-008                                                  |
| **Actor**      | Authenticated member                                      |
| **Goal**       | Register for an event and receive ticket(s)               |
| **Trigger**    | Member clicks "Register Now" on event details page        |
| **Outcome**    | Member has confirmed registration with ticket and QR code |

## Preconditions

* Event exists and registration is open
* User is authenticated
* Event has available tickets
* For paid events: User can make payment

## Journey Flow

```mermaid theme={null}
flowchart TD
    A[Click Register Now] --> B[Select ticket type]
    B --> C[Select quantity]
    C --> D{Multiple attendees?}
    D -->|Yes| E[Enter attendee details]
    D -->|No| F[Review order]
    E --> F
    F --> G{Has promo code?}
    G -->|Yes| H[Apply promo code]
    G -->|No| I[Proceed to payment]
    H --> I
    I --> J{Free event?}
    J -->|Yes| K[Confirm registration]
    J -->|No| L[Enter payment details]
    L --> M[Process payment]
    M --> N{Payment successful?}
    N -->|Yes| O[Registration confirmed]
    N -->|No| P[Handle payment error]
    O --> Q[Receive tickets via email]
    K --> Q
    P --> L
```

## Detailed Steps

<Steps>
  <Step title="Select Ticket Type">
    Member chooses from available ticket types:

    | Ticket     | Price | Description          | Availability |
    | ---------- | ----- | -------------------- | ------------ |
    | Early Bird | \$79  | Limited time offer   | 5 left       |
    | Member     | \$99  | Standard member rate | Available    |
    | Non-Member | \$149 | Full price           | Available    |
    | VIP        | \$249 | Includes dinner      | 10 left      |

    **Displayed Information:**

    * Ticket name and price
    * Description of what's included
    * Availability count
    * Member vs non-member indicator
    * "Best Value" or "Popular" badges
  </Step>

  <Step title="Select Quantity">
    Member selects number of tickets:

    * Quantity selector (1-10 typically)
    * Maximum per order limit enforced
    * Running total displayed
    * "Add another ticket type" option

    **Bulk/Group Discounts:**

    * Automatic discount applied for quantity thresholds
    * "Buy 5+, save 10%" messaging
  </Step>

  <Step title="Enter Attendee Details (Multi-Ticket)">
    For multiple tickets, capture attendee info:

    **Per Attendee:**

    | Field                | Required     | Notes               |
    | -------------------- | ------------ | ------------------- |
    | First Name           | Yes          |                     |
    | Last Name            | Yes          |                     |
    | Email                | Yes          | For ticket delivery |
    | Phone                | Configurable |                     |
    | Dietary Requirements | Configurable | For catered events  |
    | Accessibility Needs  | No           |                     |

    **Options:**

    * "Same as purchaser" checkbox for first attendee
    * Copy details from previous attendee
    * Import from contacts (if enabled)
  </Step>

  <Step title="Apply Promo Code">
    Member enters promotional code:

    **Validation:**

    * Code exists and is active
    * Code applies to selected event
    * Code applies to selected ticket type(s)
    * Usage limits not exceeded

    **Discount Display:**

    ```
    Subtotal:           $198.00
    Promo: SUMMER20    -$39.60
    ─────────────────────────────
    New Total:          $158.40
    ```

    **Error Handling:**

    * Invalid code: "This code is not valid"
    * Expired: "This code has expired"
    * Used: "You've already used this code"
    * Not applicable: "Code doesn't apply to this event"
  </Step>

  <Step title="Review Order">
    Order summary before payment:

    ```
    ┌─────────────────────────────────────────────┐
    │ Order Summary                               │
    ├─────────────────────────────────────────────┤
    │ Event: Annual Conference 2025              │
    │ Date: March 15, 2025 • 9:00 AM             │
    │ Location: Convention Center                 │
    ├─────────────────────────────────────────────┤
    │ 2x Member Ticket         $198.00           │
    │ Promo Code (SUMMER20)    -$39.60           │
    ├─────────────────────────────────────────────┤
    │ Subtotal                 $158.40           │
    │ GST (10%)                 $15.84           │
    ├─────────────────────────────────────────────┤
    │ Total                    $174.24           │
    └─────────────────────────────────────────────┘

    Attendees:
    1. John Smith (john@email.com)
    2. Jane Doe (jane@email.com)

    ☑ I agree to the terms and conditions
    ☑ I agree to the event cancellation policy
    ```
  </Step>

  <Step title="Complete Payment">
    **For Paid Events:**

    Stripe payment form:

    * Credit/Debit card
    * Apple Pay / Google Pay
    * Saved payment methods

    3D Secure authentication if required.

    **For Free Events:**

    * Skip payment step
    * "Complete Registration" button
    * Terms acceptance still required
  </Step>

  <Step title="Registration Confirmed">
    Success page displayed:

    * Confirmation number
    * Event details summary
    * QR code for check-in
    * "Add to Calendar" buttons
    * "Download Tickets" button
    * "View My Tickets" link

    **Immediate Actions:**

    * Confirmation email sent to purchaser
    * Individual tickets emailed to each attendee
    * Calendar invite attached
    * Receipt/invoice generated
  </Step>
</Steps>

## Ticket Delivery

Each attendee receives:

**Email Contents:**

* Event name and details
* Their ticket with unique QR code
* Check-in instructions
* Venue/access information
* Add to calendar links
* PDF ticket attachment

**QR Code Contains:**

* Ticket ID (encrypted)
* Attendee name
* Ticket type
* Event reference

## Special Scenarios

### Waitlist Registration

If event is sold out:

1. Member joins waitlist
2. Provides contact info
3. Notified if spot opens
4. Limited time to complete purchase

### Member-Only Events

* Only authenticated members can register
* Member validation at registration
* May have capacity limits per member

### Early Bird Pricing

* Time-limited ticket type
* Countdown timer displayed
* Auto-switches to regular price when expired

## Related Entities

* [`Event Ticket`](/entities/core/event-ticket)
* [`Event`](/entities/core/event)
* [`Payment Transaction`](/entities/integration/payment-transaction)

## Related Journeys

* [UJ-M-007](/member/journeys/view-event-details)
* [UJ-M-009](/member/journeys/receive-qr-ticket)
* [UJ-M-010](/member/journeys/transfer-ticket)
* [UJ-M-011](/member/journeys/event-checkin)

## Acceptance Criteria

### Frontend

* [ ] Ticket type selection with pricing
* [ ] Quantity selector with running total
* [ ] Attendee details form (multi-ticket)
* [ ] Promo code input with validation
* [ ] Order summary with itemized breakdown
* [ ] Terms acceptance checkboxes
* [ ] Stripe payment integration
* [ ] Success page with QR code
* [ ] PDF ticket download
* [ ] Mobile-responsive checkout

### Backend

* [ ] `POST /api/events/{id}/register` - Create registration
* [ ] `POST /api/events/{id}/validate-promo` - Validate code
* [ ] `POST /api/payments/create-intent` - Payment intent
* [ ] Webhook: `payment_intent.succeeded`
* [ ] Email service: Send confirmation + tickets

### Permissions

* [ ] Authenticated users can register
* [ ] Member-only events enforce membership

### Business Rules

* [ ] Ticket availability decremented on registration
* [ ] Promo codes validated against limits
* [ ] Tax calculated based on location
* [ ] Group discounts auto-applied
* [ ] Free events skip payment

### Error Handling

* [ ] Sold out during checkout → Error + waitlist offer
* [ ] Payment failed → Retry with preserved data
* [ ] Duplicate registration check
