=== AddToWallet for The Events Calendar ===
Contributors: lakshayaddtowallet
Tags: event tickets, tickets, wallet, apple wallet, google wallet
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Turn every Event Tickets ticket into an Apple or Google Wallet pass, so attendees carry
their ticket on their phone.

== Description ==

Someone gets tickets to your event, and Event Tickets' order confirmation page offers them
**Add to Apple Wallet** and **Add to Google Wallet** buttons, right under their tickets.
Every ticket on the order gets its own pass, with the attendee's name, the event, the date,
time and venue, and a barcode carrying Event Tickets' own security code, the one its
check-in uses.

Works with free and paid tickets sold through Tickets Commerce, on events from The Events
Calendar or on any other post you sell tickets on.

= Design the pass =

The *Pass design* tab is a visual editor with a live Apple Wallet and Google Wallet
preview, front and back, filled in with your latest ticket.

* Your business name, logo and colour.
* A header line, the pass title and up to three fields on the front.
* Sections on the back: text, links, phone numbers, email addresses and addresses.
* "+ Data Field" puts each ticket's details on the pass: the attendee's name, the event,
  ticket type, date, start and end time, venue and its address, organizer and their
  contact details, event page, ticket and order numbers, price paid and more.
* A hero image, with a different image per event if you like.
* The barcode format, and a Wallet reminder before the event.

= How it works =

* The buttons appear on Event Tickets' order confirmation (success) page, under the list
  of tickets. To place them yourself, put the `[atw_tec_wallet_passes]` shortcode on that
  page.
* An order for several tickets gets one pass per ticket, each labelled with the attendee's
  name, because each person needs their own barcode at the door.
* The passes are created on your server with your AddToWallet API key. The key never
  reaches your visitors' browsers.
* The browser sends only the order reference Event Tickets already puts in its confirmation
  link, and the ticket details are read from Event Tickets, so nobody can create a pass for
  someone else's order or put made-up details on one. An order placed while logged in is
  only shown to that account.
* Reloading or sharing the confirmation page never creates a second pass for the same
  ticket.
* When a card payment takes a moment to confirm, the page waits for it rather than giving
  up.

= Refunds, cancellations and changes =

When an order is refunded, cancelled, reversed or fails, when a ticket is deleted, or when
you set the event's status to Canceled in The Events Calendar, the pass in the attendee's
wallet is marked expired straight away. When the event moves, changes venue, or anything
else on the pass changes, the pass is updated to match, without using another credit.
This all happens on your server, from Event Tickets' and The Events Calendar's own
notifications, with a check every ten minutes for anything changed some other way. You
choose which of these expire a pass on the Settings tab.

= Requirements =

* Event Tickets, with Tickets Commerce turned on (Tickets › Settings › Payments) and a
  success page set
* The Events Calendar, for event dates, venues and organizers on the pass (optional:
  tickets on other posts get passes without them)
* An AddToWallet account and API key

= Coming from the 1.x zip? =

AddToWallet for The Events Calendar 1.x (folder `events-calendar-addtowallet`) was handed
out as a download. This plugin installs into a new folder, so WordPress treats it as a
separate plugin. When you activate it, it copies your 1.x settings and the record of every
pass 1.x issued, and from then on it creates, updates and expires the passes. Then
deactivate and delete the 1.x plugin. Until you do, it stays switched off and you will see
a reminder. A confirmation page using the 1.x `[tec_addtowallet]` shortcode keeps working.

== Frequently Asked Questions ==

= Which tickets get a pass? =

Every ticket on a Completed order: paid orders, and free tickets. You can also issue
passes while a payment is still pending, though it may never be paid.

= No buttons appear. What should I check? =

* Event Tickets has no success page set (Tickets › Settings › Payments), so buyers never
  see a confirmation page. The Settings tab warns about this.
* You are out of AddToWallet credits.
* The order has a status you do not issue passes for.

The *Tickets & passes* tab lists every ticket and whether it received a pass.

= Do RSVPs get a pass? =

Not in this version: passes are issued for tickets sold through Tickets Commerce, free or
paid.

= What does the barcode scan as? =

The ticket's security code from Event Tickets, the same code its own check-in compares
against.

= Does expiring a pass refund the credit? =

No. Each pass costs one credit when it is created.

== External services ==

This plugin connects to the AddToWallet API at https://app.addtowallet.co to create,
update and expire Apple Wallet and Google Wallet passes. Without this service it cannot
issue passes.

* When you save an API key, the plugin checks it by reading your credit balance
  (`/api/payment/usage`), sending only the key. The balance is read again when you open the
  Settings tab.
* When an order's confirmation page loads and the order qualifies, the plugin sends the
  details you put on each ticket's pass from your server to AddToWallet
  (`/api/card/create`). With the default design that is the attendee's name, the event
  name, ticket type, date and time, the event's page address, the venue and its address,
  the organizer's name, email and phone (from The Events Calendar), the ticket's security
  code (as the barcode), your site name, and the logo, image and colors you configured. The
  attendee's email address, the purchaser's name or the price are only sent if you add
  them to the pass design.
* When an order is refunded or cancelled, a ticket is deleted or an event is canceled, it
  sends the pass id and your logo so the pass can be expired; when the event or the ticket
  changes, it sends the pass id with the updated pass details (`/api/card/edit`).
* The Help tab's contact form sends the name, email address and message you type, plus your
  site address and the plugin version, to AddToWallet support (`/api/admin/contactus`),
  only when you press Send.

Every request to `/api/card/*` and `/api/payment/usage` carries your API key to
authenticate it. Your API key is never sent to the attendee's browser.

The service is provided by AddToWallet: [Terms of Service](https://addtowallet.co/terms/),
[Privacy Policy](https://addtowallet.co/privacy-policy/).

== Screenshots ==

1. Event Tickets' order confirmation page with Add to Google Wallet and Add to Apple Wallet buttons for each ticket.
2. Pass design: brand, front, back and hero image, with a live Apple Wallet and Google Wallet preview.
3. Tickets & passes: every ticket, with whether its wallet pass was issued, expired or failed.
4. Settings: which orders issue passes and what expires them, and the account's credit balance.

== Changelog ==

= 2.0.0 =
* First release on WordPress.org. Replaces the 1.x zip: settings and issued passes are copied over on activation.
* New admin screen, with Pass design, Tickets & passes, Settings and Help tabs.
* Pass design: a visual editor with a live Apple Wallet and Google Wallet preview, front and back.
* Choose the business name, header line, pass title and up to three front fields, using "+ Data Field" to add ticket details: attendee, event, ticket type, date and time, venue, organizer and more.
* Add sections to the back of the pass: text, links, phone numbers, email addresses and addresses. By default the back has the venue (opens a map), the event page and the organizer's contact details.
* Hero image variations per event.
* Passes are now expired when an order is refunded, cancelled, reversed or fails, when a ticket is deleted, and when an event is canceled. You choose which on the Settings tab.
* When an event moves, changes venue or its details change, the passes already in wallets are updated, without using another credit.
* Choose which order statuses issue passes (Completed, and optionally Pending).
* While a card payment is still being confirmed, the confirmation page waits for it instead of showing nothing.
* Times on the pass are in the event's own time zone, and all-day events show no times.
* The Wallet reminder before the event can be switched off.
* Passes are created as soon as the confirmation page loads. The 1.x "When to issue" setting (wait for a click) is gone.
* The API key is checked with AddToWallet before it is saved.
* Tickets & passes shows why a pass could not be created (for example, no credits left), and when a pass was updated, expired (and why) or failed to update or expire.

= 1.3.0 =
* Passes report which integration created them. Requests identify the plugin and its version.
* The Settings tab warns when Tickets Commerce has no published success page.

= 1.2.0 =
* Passes are created as soon as the confirmation page loads, with a setting to go back to a button.

= 1.1.0 =
* Attendees & passes and Support tabs.

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 2.0.0 =
Replaces the AddToWallet for The Events Calendar 1.x zip. Activate this plugin, check your settings were copied over, then deactivate and delete the old plugin (folder events-calendar-addtowallet).
