=== Tickets² by BSquared ===
Contributors: bsquaredsoftware
Tags: tickets, rsvp, events, check-in, stripe
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Requires Plugins: bsquared-calendar
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Tickets and RSVPs for Calendar² events: free and paid tickets, capacity, check-in at the door.

== Description ==

Tickets² adds tickets and RSVPs to events made with Calendar², the events calendar from the same team. It needs Calendar² 1.2.1 or newer, and stays switched off, with a notice saying why, until Calendar² is active.

The ticket form appears on the event's own page. Visitors pick a date, choose their tickets and either confirm an RSVP straight away or pay through Stripe's hosted checkout page. Card details are entered on Stripe's page, never on your site.

= Tickets and RSVPs =

* Free RSVPs with "Going" and "Not going", and an optional email confirmation step before a place is held. By default it is only asked for when places are limited.
* Paid tickets through Stripe Checkout. Card payments always; Apple Pay and Google Pay when your Stripe account shows them; and, if you choose, instant local methods such as iDEAL, Bancontact, BLIK, TWINT, MobilePay, Revolut Pay and Klarna, for the currencies they support.
* Ticket types per event, each with its own price, an optional sale price for a set period, sale start and end times (by default, sales for a date close when it starts), and a minimum and maximum per order.
* Repeating events are sold date by date. A series pass covers every upcoming date of an event in one ticket.
* Capacity per ticket type and date, or one shared capacity for several types. Places are held while a buyer checks out and released if they don't finish.
* Coupon codes, as a percentage or a fixed amount.
* An optional booking fee for each event, as a flat amount or a percentage, charged per ticket or once per order. Buyers see it with the price before they pay.
* Optional name, or name and email, for each ticket holder.
* Complimentary tickets added by hand from the admin.

= Emails and the buyer's tickets =

* Ticket emails with a QR code for each ticket and a calendar file (.ics), plus receipts for paid orders and refund emails.
* You can change the subject and wording of each email, and send yourself a test.
* A "My tickets" page, created on activation, where buyers ask for a link by email and see their upcoming tickets.

= At the door =

* A check-in screen that scans ticket QR codes with a phone or laptop camera, or a handheld scanner, and lets staff search by name, email or ticket reference. It also works without JavaScript, by search.
* A Door Staff role that can check people in and see the attendee list, and nothing else.
* Attendee lists you can export as CSV or print (the printed list leaves out email addresses).

= Running events =

* Orders and attendees screens with filters and CSV export.
* Full and partial refunds, per ticket, from the order screen.
* When an event's date is cancelled, postponed or moved in Calendar², Tickets² can email the ticket holders and, for a cancelled date, refund them all, in batches. Nothing is sent or refunded until you start it.
* Ticket prices and availability are added to the structured data (schema.org) that Calendar² prints for each event.
* Site Health checks for payments, the Stripe webhook, scheduled jobs, email sending and the visitor-address setting.
* WP-CLI commands for orders, refunds, payments, attendee exports, stock checks, retention and the migration.

= Moving from Event Tickets =

Tickets² can copy Event Tickets' RSVPs, Tickets Commerce tickets, orders, attendees and check-ins for Calendar² events on its own screen (Calendar² → Migrate from Event Tickets, shown while Event Tickets is active or a migration has been started). It starts with a dry run that reports what will move and what won't, then switches over and turns Event Tickets off. You can switch back as long as Tickets² hasn't sold, refunded or held places on the moved tickets. Event Tickets shortcodes already on your pages keep working after the switch, and tickets bought through Event Tickets can still be checked in. Tickets on ordinary pages and posts, and coupons, aren't moved: the dry run says so. The same steps are available as WP-CLI commands.

= Privacy tools =

* Tickets² adds its data to WordPress's personal data export and erase tools.
* An optional retention setting removes ticket holders' and buyers' names, emails and answers a set number of days after the event. Ticket counts, amounts and dates stay, and you choose how many years paid orders keep the buyer's name and email.
* Suggested text for your privacy policy, with the parts only you can decide left for you to fill in.
* Your data stays when you delete the plugin, unless you tick "Delete all Tickets² data when the plugin is deleted".

The plugin's interface is written in US English and ships with a British English (en_GB) translation.

== External services ==

Tickets² connects to one outside service, Stripe, and only after the site owner adds Stripe API keys under Ticket settings → Payments. Without keys it sells free RSVPs only and makes no outside requests.

Stripe (https://stripe.com) takes payments for paid tickets. Tickets² calls Stripe's API at api.stripe.com:

* When a buyer checks out: it creates a Checkout Session and sends the buyer to Stripe's hosted payment page. The request carries each ticket's name, event and date, the price, quantity and currency, the buyer's email address, the order reference, a random identifier for your site, the page language, and the addresses to return to afterwards. The buyer enters their payment details on Stripe's page, not on your site.
* When Stripe reports a payment, every few minutes while an order is unpaid, and when you press "Check payments now": it reads the payment's status, refunds and disputes.
* When an admin refunds an order, or refunds the buyers of a cancelled date: it sends the payment, the amount, a refund reference and the reason.
* When an admin tests the connection or sets up the webhook: it reads from your Stripe account, creates and cancels a test session in test mode, and creates or updates the webhook endpoint that tells your site about payments.

Stripe's terms: https://stripe.com/legal/ssa
Stripe's privacy policy: https://stripe.com/privacy

Tickets² also sends one request to your own site's address from the Site Health screen, to check that Stripe's webhooks can reach it.

== Installation ==

1. Install and activate Calendar² (the plugin slug is `bsquared-calendar`).
2. Install and activate Tickets².
3. Edit an event and add ticket types in the Tickets box.
4. For paid tickets, add your Stripe keys under Ticket settings → Payments and set up the webhook from the same screen.

== Frequently Asked Questions ==

= Does Tickets² work without Calendar²? =

No. Tickets are sold for Calendar² events, so Tickets² needs Calendar² 1.2.1 or newer. Without it, Tickets² does nothing except show a notice to administrators.

= Do I need Stripe? =

Only for paid tickets. Free RSVPs work without any payment set-up.

= Does any card data touch my site? =

No. Buyers pay on Stripe's hosted checkout page, and your site only receives the payment's status from Stripe.

= How are my Stripe keys stored? =

In their own option, which WordPress doesn't load on ordinary page views. The settings screen shows only the last four characters of a saved secret, and Tickets² never writes a key to its own logs. You can also set the keys as constants in wp-config.php instead. One thing is outside the plugin's control: plugins that log outgoing HTTP requests can record your Stripe API key. If you use one, exclude api.stripe.com from its logging.

= Can I use it for repeating events? =

Yes. Each date of a repeating Calendar² event is sold on its own, with its own capacity, and a series pass can cover every upcoming date.

= What happens to my data if I delete the plugin? =

Nothing is deleted unless you choose to delete the plugin's data on uninstall (Ticket settings → Privacy). Scheduled jobs, the plugin's capabilities and the Door staff role are always removed. The My tickets page stays, because it is your content.

== Screenshots ==

1. The ticket form on an event page: ticket types, prices and places left.
2. My tickets: a buyer's upcoming tickets with their QR codes.
3. The ticket email with its QR code.
4. The door check-in screen: a ticket found and checked in.
5. The orders screen with filters and the sales summary.
6. Adding ticket types to an event in the Tickets box.

== Credits ==

Tickets² includes two small open-source libraries, with their licences in the plugin:

* QR codes are drawn with qrcode-generator by Kazuhiko Arase (MIT), in `lib/qrcode-generator/`. Our changes are listed at the top of the file.
* The check-in scanner reads QR codes with qr by Paul Miller, used under its MIT licence, in `assets/qr-0.7.2/`. It contains code inspired by ZXing (Apache-2.0); the notice is in `assets/qr-0.7.2/NOTICE`.

== Changelog ==

= 1.0.2 =
* Fix: on sites whose database is SQLite (such as WordPress Playground), the orders screen no longer stops with a critical error. The event picker on the orders, attendees and coupons screens used a query form SQLite doesn't accept.

= 1.0.1 =
* Fix: the Tickets box on the event screen lays its ticket types out to fit the editor. Below about 1200 px of box width (the block editor with its sidebar open), each ticket type becomes a wrapping row of labelled fields; prices such as 20.00 and "No limit" are no longer cut off; the Pricing and Tax headings no longer run together.
* Fix: the orders list's filters keep each label next to its control, and the sales summary heading sits on its own line below the status links.
* Fix: the check-in screen's Torch button shows only once the camera is running and the camera can light a torch.
* Fix: in the sales summary, a refund of particular tickets is counted under those tickets' types. Refunds of an amount with no tickets are still spread over the order's ticket types by value.
* Thanks to PeepSo for the series-pass date-move test case.

= 1.0.0 =
* First public release: RSVPs and paid tickets through Stripe Checkout for Calendar² events, capacity per date, series passes, coupons, ticket emails with QR codes, check-in at the door, refunds, privacy tools, and a migration from Event Tickets.
