=== AddToWallet for Sugar Calendar ===
Contributors: addtowallet
Tags: events, tickets, apple wallet, google wallet, sugar calendar
Requires at least: 5.8
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds "Add to Apple Wallet" and "Add to Google Wallet" buttons to the Sugar Calendar ticket receipt.

== Description ==

When someone buys a ticket, this plugin adds wallet buttons to the Sugar Calendar order
receipt. Clicking one puts the ticket in their phone, alongside their boarding passes —
the event, the date, the venue and a barcode — so they are not digging out an email at
the door.

Every ticket on the order gets its own pass with its own barcode, because an order for
four tickets is four people walking through a door.

The barcode carries the same ticket code Sugar Calendar printed on the emailed ticket, so
the two always match.

When an order is refunded or trashed, its passes are marked expired in the holder's
wallet straight away.

Passes are created through the AddToWallet API. Your API key is stored on your server and
is never sent to visitors' browsers.

= What it needs =

* Sugar Calendar (Lite or Pro) 3.12 or later, with a Payment Success Page set
* An AddToWallet account and API key

= What it costs =

One credit per pass, so an order for four tickets costs four. A ticket is only ever charged
once, however many times the receipt is reloaded.

By default passes are created the moment the receipt loads, so every completed order
spends a credit per ticket. Turn off "When to issue" on the Settings tab to show a button
instead, and pay only for the buyers who ask for a pass.

== Installation ==

1. Upload the plugin and activate it.
2. Go to AddToWallet in the admin menu and paste your API key.
3. Set a logo, or leave it blank to use your site icon.
4. Check a Payment Success Page is set under Sugar Calendar → Settings → Payments.
5. Buy a ticket yourself — Stripe test mode works — and check the buttons appear.

== Frequently Asked Questions ==

= Does the buyer need an account? =

No. Sugar Calendar sells to guests, and the receipt works for them. The plugin identifies
the order from the receipt link Sugar Calendar sends the buyer, and checks it exactly the
way Sugar Calendar does before showing the receipt.

= Where exactly do the buttons appear? =

Directly under the receipt card. If your theme builds its own receipt page, place them
yourself with the shortcode `[sugar_calendar_addtowallet]`.

= What happens when an order is refunded? =

Every pass on it is marked expired, so it stops looking like a ticket the holder can use.
The same happens when an order is moved to the trash. Either can be switched off under
"When to expire a pass". Expiring a pass does not refund its credit.

= Does it work with RSVPs? =

No. Sugar Calendar's RSVPs have no order or ticket code to put on a pass; only ticket
orders get wallet passes.

== Changelog ==

= 1.0.0 =
* First release: wallet buttons on the Sugar Calendar receipt, one pass per ticket,
  barcode carrying Sugar Calendar's own ticket code, expiry on refund and trash, settings
  screen with a live pass preview and credit balance, Tickets & passes and Support tabs.
