The marketing CMS where agents draft and people publish
Menu

Events: paid tickets (phase 2)

The plan for paid tickets in the @spillway/events module. Phase 1, free registration with a wait list, is built; this phase is not. Until it is, a paid event keeps its own registration off and shows its outside ticketing link as the Register button.

Goals

  • An event sells tickets through Stripe Checkout, on the site's own Stripe account (Site settings → Integrations → Stripe), with no card data on the site.
  • An event has one or more ticket types: a name (General, Student, Member), a price in the site's currency (0 for a free type beside paid ones), places of its own or a share of the event's, a sales window, and who may buy it (everyone, members, a member group, as registration already allows).
  • One order buys several tickets (a quantity per type, a cap per order), with a name and email for each ticket holder when the event asks for it.
  • Staff refund a ticket in full or in part from the attendee list; a person cancels with the link in their email and gets the refund the event's policy allows.
  • Everything phase 1 does keeps working: capacity, the wait list, emails with a calendar file, reminders, change notices, check-in, CSV export, messages, the AI tools (read-only, plus drafts) and the data rules.

Non-goals

  • Seating charts, reserved seats and timed entry.
  • Discount codes and bundles (a later phase; the data model leaves room for them).
  • Selling outside Stripe, invoices, tax calculation beyond what Stripe Tax does, and payouts to third parties.

How it works

  1. Settings. Under Module pages → Events → an event → Settings, Tickets lists the ticket types. An event with a paid type needs Stripe connected; saving refuses it otherwise, as a payment form does today.
  2. Holding places. On Buy tickets, the module takes the places in one statement per type, as a registration does now (api.store.increment with the type's and the event's limits), and records an order pending with the places held for 30 minutes. A sold-out type offers the wait list, as now.
  3. Checkout. The module creates a Stripe Checkout Session with one line per type and quantity, the order's id in its metadata, expires_at 30 minutes ahead, and the event page as the return address. This needs a small core addition: api.payments.checkout({ siteId, lines, metadata, successUrl, cancelUrl, customerEmail }) over core's existing Stripe client (stripe/service.ts), so the module never holds the secret key.
  4. Confirmation. Stripe's webhook, which core verifies already, reaches the module through a new hook, payment.completed (and payment.expired), with the session's metadata. On completed the order becomes paid, each ticket a registration registered with its type and amount, and the confirmation goes out with the calendar file and, per ticket, a code for check-in. On expired the held places go back and the wait list moves.
  5. Refunds. api.payments.refund({ paymentIntent, amount, reason }), with the person's permission check and an audit row. A refunded ticket is cancelled and its place offered to the wait list. The event's refund policy (full until a date, none after, or staff only) decides what a self-cancel refunds; the cancel page says it before the person confirms.
  6. Check-in. Each ticket has a short code (in the email and as a QR code on the person's registration page); the check-in screen takes the code or a name.

Data

RecordFields
ticket_type (per event)name, price (minor units), currency, places (or a share of the event's), sales window, audience, order cap
orderthe buyer's name and email, lines (type, quantity, amount), status pending, paid, expired, refunded, partially_refunded, the Checkout Session and the payment intent, the hold's end
registrationas now, plus the order, the ticket type, the amount paid, the refunded amount and the ticket code

Orders are personal data: in Your data with the registrations, erased with them, and kept for the period the site's accounting needs (a setting, 7 years by default, with the person's name and address removed after the retention period of phase 1).

Core changes it needs

Small, each in its own change with tests on both databases:

  • api.payments.checkout and api.payments.refund for trusted modules (capability payments), over the site's Stripe settings, audited.
  • The payment.completed and payment.expired hooks, fired from the Stripe webhook core already verifies, for sessions a module created.
  • Nothing else: ticket types, orders and holds live in the module's store.

Tests

  • The module's server test with a fake Stripe (as test/stripe.test.ts has): buy, pay, expire a hold, sell out a type, refund in part and in full, the wait list after a refund, webhooks replayed twice.
  • An e2e smoke test against Stripe's test mode or the fake: buy two tickets on a phone, pay, check in by code.

Open questions

  • Fees: does the site absorb Stripe's fee or pass it on as a line?
  • Taxes: Stripe Tax on or off per event, and what the receipt says.
  • Whether a free ticket type beside paid ones skips Checkout entirely (likely yes).

Spillway 0.1.24

Was this page helpful?