diff --git a/README.md b/README.md index e74281f..544cc91 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,25 @@ -# SeatLayer Python Server SDK for Reserved Seating +# SeatLayer Python SDK: seat booking, reserved seating and season ticket API [![CI](https://github.com/seatlayer/seatlayer-python/actions/workflows/ci.yml/badge.svg)](https://github.com/seatlayer/seatlayer-python/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/seatlayer.svg)](https://pypi.org/project/seatlayer/) [![Python](https://img.shields.io/pypi/pyversions/seatlayer.svg)](https://pypi.org/project/seatlayer/) [![License: MIT](https://img.shields.io/badge/license-MIT-111827.svg)](LICENSE) -The official Python client for the SeatLayer API. The `seatlayer` package lets a Python backend inspect seat holds, price orders from server data, book reserved seats and verify webhooks, with no runtime dependencies. SeatLayer is seating chart and reserved-seat ticketing software built for venues up to stadium scale. +Add reserved seating and season tickets to a Django, FastAPI or Flask backend with `seatlayer`, +SeatLayer's official Python SDK. Your views read what a buyer holds with the real prices, book it +under your own order id and verify SeatLayer's signed webhooks; the package uses only the standard +library and runs on Python 3.10 and newer. -SeatLayer's official Python server SDK is the trusted side of its reserved seating and seat -booking API. Inspect what a hold really contains, price from server-owned seating-chart data, -and book with a stable `booking_ref`, while managing charts, events, inventory, allocations, -and webhooks through one typed ticketing API client. +## What SeatLayer is + +SeatLayer is reserved-seat ticketing and seating software: organizers sell with hosted checkout, +a box office, door check-in and season tickets, and platforms add the same seat maps, with 3D +seat views, through the SeatLayer SDK and API. One chart drives the 2D map, the 3D venue and the +view from each seat (3D for venues up to 60,000 seats; the 2D map benchmarked at 200,000 seats). + +[Website](https://seatlayer.io/) · [For developers](https://seatlayer.io/developers/) · +[Season tickets](https://seatlayer.io/season-tickets/) · [Pricing](https://seatlayer.io/pricing/) · +[Live demo](https://seatlayer.io/demo/) [`seatlayer` on PyPI](https://pypi.org/project/seatlayer/) · [Python server SDK guide](https://docs.seatlayer.io/server-sdk/python/) · @@ -25,10 +34,6 @@ and webhooks through one typed ticketing API client. **Start here:** [Quickstart](https://docs.seatlayer.io/start/quickstart/) · [Holds and checkout](https://docs.seatlayer.io/buyer-sdk/holds-and-checkout/) · [Python server SDK guide](https://docs.seatlayer.io/server-sdk/python/) · [SDK catalog](https://docs.seatlayer.io/sdk-catalog.json) · [Pricing](https://seatlayer.io/pricing/): 100 sold seats free every month, then 10¢ down to 5¢ per sold seat. No subscription, and purchased credits never expire. Test mode is free. -## Scale evidence - -Benchmarked on public 100,000-, 150,000- and 200,000-seat venue fixtures on 15 September 2026: 200,000 seats chart-ready in 1.95 s, desktop, local production build. Tested at 10,000 simulated concurrent buyers on one 12,000-seat event (18 September 2026): engine-side hold latency p99 9 ms, zero server errors. Method, fixtures and run files: https://github.com/seatlayer/seatlayer-performance. Live 200,000-seat stadium demo: https://app.seatlayer.io/demo/play/century-stadium-200k. - ## Install the Python seat booking SDK ```bash @@ -86,7 +91,13 @@ Keys carry their own mode. `sk_test_…` keys can only touch test-mode events an live ones; crossing them returns `403 mode_mismatch`, surfaced as `SeatLayerAuthError` with `is_mode_mismatch`. -## Fixed Renewable Seasons +```python +seatlayer = SeatLayer(os.environ["SEATLAYER_SECRET_KEY"]) +if os.environ.get("ENV") == "production" and seatlayer.mode != "live": + raise RuntimeError("Refusing to boot production against test-mode seating data.") +``` + +## Season tickets (Fixed Renewable Seasons) `seatlayer.seasons` has all 90 season operations: seasons and their packages, dates and package prices (per price type: `adult`, `child`, `concession`, `senior`, `student`), sales @@ -121,12 +132,6 @@ commits are sent once and never retried by the SDK, so give each one your own stable id; sending the same id again is safe. A buyer session is sent once too, and repeating it is not safe: if its answer is lost, revoke what was created and create one new session. -```python -seatlayer = SeatLayer(os.environ["SEATLAYER_SECRET_KEY"]) -if os.environ.get("ENV") == "production" and seatlayer.mode != "live": - raise RuntimeError("Refusing to boot production against test-mode seating data.") -``` - When SeatLayer takes the season's payments, renew a holder with no hosted page: read the price with `retrieve_season_renewal_quote`, then start a checkout and send the holder to `payment["url"]`. For a renewal taken by phone or at the box office, record the holder's intent @@ -402,6 +407,8 @@ def seatlayer_webhook(): return "", 200 ``` +Django: pass `request.body`. FastAPI: pass `await request.body()`. + ## Errors ```python @@ -426,7 +433,7 @@ requests. ## Reliability -**Retries and idempotency.** Reads retry 408, 429 and 5xx responses with backoff. Forty-one +**Retries and idempotency.** Reads retry 408, 429 and 5xx responses with backoff. Forty-three mutations opt into exact header replay: `charts.create`, `charts.copy`, `templates.instantiate_template`, `events.create`, `workspaces.create`, `performance_groups.create`; on `seasons`, `create_season`, `update_season`, `delete_season`, @@ -437,8 +444,8 @@ mutations opt into exact header replay: `charts.create`, `charts.copy`, `duplicate_season_to_live`, `create_season_holder_import`, `create_season_holder_import_from_season`, `create_season_renewal_offers`, `create_season_amendment`, `refund_season_order`, `cancel_season_order`, -`cancel_season_order_date`, `refund_season_performance`, `release_season_lapsed_offers`, and -`create_season_renewal_checkout`; +`cancel_season_order_date`, `refund_season_performance`, `release_season_lapsed_offers`, `create_season_renewal_checkout`, `set_aside_season_block`, +and `release_season_block`; `holders.update_holder`, `holders.create_holder_transfer`, `holders.create_holder_return`, and `holders.create_holder_renewal_checkout`; `orders.refund_event_order` and `orders.cancel_event_order`; and `event_series.create_event_series`, `event_series.add_event_series_dates`, and @@ -454,7 +461,7 @@ reconcile an unknown outcome before trying again. ```python SeatLayer( os.environ["SEATLAYER_SECRET_KEY"], - max_retries=3, # attempts for reads and the 41 exact-header-replay mutations + max_retries=3, # attempts for reads and the 43 exact-header-replay mutations timeout=30.0, # seconds, per attempt ) ``` @@ -507,34 +514,42 @@ Neither of these two (setting up a gateway, a server-side live feed) is part of ## Frequently asked questions +### What does the SeatLayer API do for a ticketing platform? + +SeatLayer gives your Python backend one API for seating charts, live seat holds, booking, box office +sales and season tickets, with official SDKs in Node.js, Python, PHP, Java, Go, Ruby and .NET. +Buyers pick seats on the same SeatLayer map on the web, iOS, Android, Flutter and React Native, and +your server books what they hold with your own order id, so a retried booking never sells a seat +twice. You pay only for sold seats: 100 a month are free, then 10¢ down to 5¢ a seat, with no +subscription, and holds and test mode cost nothing. Its measured results are under Scale evidence +below. + +### How much does the SeatLayer API cost? + +Building and testing is free: test mode has no time limit, needs no card and uses no credits. Live, +with your own checkout, you pay one credit per confirmed sold seat: the first 100 sold seats each +month are free, then 10¢ down to 5¢ a seat, with no subscription, and purchased credits never +expire. Designing charts, showing the map, holds and releases never use a credit. An event that +sells through SeatLayer's checkout costs $0.50 per ticket instead, and your first 25 tickets are +free. + ### How do I book seats from Python? -Create a client with your secret key, obtain a hold id (either from the buyer's -browser session or by holding server-side) and call `inventory.book(event_key, hold_id=..., booking_ref=...)`. -`booking_ref` is your own stable order id and is the join between SeatLayer -inventory and your commercial order, so the same reference identifies the booking -in Booking History and when you later cancel it. For phone orders, box office, and -comps, `inventory.book_best_available` books outright with no browser involved. - -### What does the server SDK do compared with the buyer SDK? - -The buyer SDK runs where the ticket buyer is: it renders the interactive seating -chart, handles seat selection, and creates temporary holds. This server SDK is the -trusted side. It authenticates with your secret key, inspects what a hold actually -contains, prices from server-owned data, and books. Never bundle the secret key -into a browser or a mobile app. Browser surfaces get short-lived, origin-bound -tokens that you mint here. - -### How do temporary holds work server-side? - -A hold reserves seats against concurrent buyers for a limited window. -`inventory.retrieve_hold(event_key, hold_id)` is the authoritative answer for what is held -and at what price, so charge from its `items` rather than from anything the browser -sent you. When an order runs longer than the checkout window, `inventory.extend_hold` -renews the hold instead of releasing and re-holding, which would hand the seats to -whoever is racing for them. Bookings carry the server's exact-selection plus -`booking_ref` safeguard, but the SDK sends each booking once; reconcile an unknown -outcome before trying again. +Create a client with your secret key, read the buyer's hold with `inventory.retrieve_hold` to get +the real seats and prices, take the payment, then call +`inventory.book(event_key, hold_id=..., booking_ref=...)` with your own order id as `booking_ref`. +For phone orders, the box office and comps, `inventory.book_best_available` picks and books the best available seats in one call, with no browser involved. Keep that `booking_ref` for the order: it finds the +booking again in `inventory.list_bookings` and cancels it with `inventory.unbook`. + +### How do I stop two buyers taking the same seat? + +In the SeatLayer picker, a buyer's seats are held when they go to checkout; with the headless `SeatingChart`, your page calls `hold()`. The hold keeps those seats for that buyer for a set time, which you can change +per event, and every other buyer sees them taken. Your server reads the hold with +`inventory.retrieve_hold`, charges from the prices it returns rather than anything the browser sent, +and books it; `inventory.extend_hold` gives a slow checkout more time without letting the seats go. +If a booking call times out, check `inventory.list_bookings` for that `booking_ref`, or repeat the exact same +booking with the same hold and `booking_ref`: seats already booked under it are not sold again, +though the repeat can return an empty booked list. ### Can I use my own payment provider? @@ -544,6 +559,24 @@ touches the money. If you would rather SeatLayer run the checkout for an event (`events.replace_event_buyer_checkout`), buyers pay through one of 14 payment gateways, including Stripe, PayPal and Square, straight into your own account. +### How do I sell season tickets and renewals through an API? + +The season API is in this SDK: `seatlayer.seasons` has all 90 season operations. You create a season +from its dates with `create_season`, the buyer chooses one seat in the browser `SeasonPicker` and +the season hold takes it on every date at once, and your server books it with `book_season_hold`; +for the next season, `create_season_renewal_offers` offers each holder the same seat. +`set_aside_season_block` sets season seats aside on every date before sales open, and with your own +checkout each season seat uses one SDK credit per date, like any other sold seat. + +### Is there a Python API for ticket seat maps? + +Yes. Buyers pick seats on the SeatLayer seat map in their browser or app, and the `seatlayer` +package lets your Django, FastAPI or Flask backend create events on your seating charts, read what a +buyer holds, book it and sell season tickets. The client is synchronous and uses only the standard +library, so call it from Django views or from plain `def` routes in FastAPI. To verify a webhook, +pass the raw body: `request.body` in Django, `await request.body()` in an `async def` FastAPI +route, `request.get_data()` in Flask. + ## Continue your Python integration - [Follow the Python server SDK guide](https://docs.seatlayer.io/server-sdk/python/) @@ -560,6 +593,9 @@ Stripe, PayPal and Square, straight into your own account. (`llms.txt`) for an agent-readable map of the documentation. - [Explore every SeatLayer SDK on GitHub](https://github.com/seatlayer) across web, mobile, and server. +- [Season ticket API guide](https://seatlayer.io/guides/season-ticket-api/): build a season end to end. +- [Box office](https://seatlayer.io/box-office/): sell at the counter from the same live seats. +- [SDK and API overview](https://seatlayer.io/developers/) and [pricing](https://seatlayer.io/pricing/). ### Other SeatLayer SDKs @@ -567,6 +603,8 @@ Stripe, PayPal and Square, straight into your own account. | --- | --- | | JavaScript | [`@seatlayer/js`](https://www.npmjs.com/package/@seatlayer/js) | | React | [`@seatlayer/react`](https://www.npmjs.com/package/@seatlayer/react) | +| Vue | [`@seatlayer/vue`](https://www.npmjs.com/package/@seatlayer/vue) | +| Angular | [`@seatlayer/angular`](https://www.npmjs.com/package/@seatlayer/angular) | | React Native | [`@seatlayer/react-native`](https://www.npmjs.com/package/@seatlayer/react-native) | | iOS | [`seatlayer-ios`](https://github.com/seatlayer/seatlayer-ios) | | Flutter | [`seatlayer`](https://pub.dev/packages/seatlayer) | @@ -579,6 +617,10 @@ Stripe, PayPal and Square, straight into your own account. | Java (server) | [`io.seatlayer:seatlayer-java`](https://central.sonatype.com/artifact/io.seatlayer/seatlayer-java) | | Go (server) | [`github.com/seatlayer/seatlayer-go`](https://pkg.go.dev/github.com/seatlayer/seatlayer-go) | +## Scale evidence + +Benchmarked on public 100,000-, 150,000- and 200,000-seat venue fixtures on 15 September 2026: 200,000 seats chart-ready in 1.95 s, desktop, local production build. Tested at 10,000 simulated concurrent buyers on one 12,000-seat event (18 September 2026): engine-side hold latency p99 9 ms, zero server errors. Method, fixtures and run files: https://github.com/seatlayer/seatlayer-performance. Live 200,000-seat stadium demo: https://app.seatlayer.io/demo/play/century-stadium-200k. + ## Development ```bash