=== altersverifikation.ch for WooCommerce ===
Contributors: siebenberge
Tags: age verification, age check, alcohol, switzerland, checkout
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 8.2
Stable tag: 0.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Age checks for Swiss shops: customers verify once with ID and selfie, then confirm each order with a passkey. The shop only sees "18+ confirmed".

== Description ==

For Swiss online shops that sell alcohol, tobacco or other age-restricted products. Verification runs on altersverifikation.ch; the shop never receives ID data, only the result.

* Age limit per product or product category (16+ or 18+), or for all orders.
* After the order: paid orders stay on "Age check pending" until the age is confirmed, then move to "Processing" automatically.
* Or before the purchase: cart and checkout show a notice, and the order can only be placed once the age is confirmed (classic and block checkout).
* Customers get the invitation by email, plus a button on the thank-you page, in the order emails and under "My account".
* Results arrive by signed webhook, with an hourly sync as fallback.
* Optional: remember the confirmation in the customer account. Logged-in customers who agree during the check are confirmed on later orders without Face ID, as long as their verification is valid (12 months). Off by default; this confirms the account, not the person placing the order, so the shop is responsible for its use.
* Compatible with HPOS (custom order tables) and the block checkout.
* German, French and Italian.
* Optional: "Age verification powered by altersverifikation.ch" badge in the footer or anywhere via the shortcode [altersverifikation_badge] (off by default).

An account at altersverifikation.ch is required.

== External services ==

This plugin connects to altersverifikation.ch (operated by siebenberge gmbh, Switzerland) to verify the age of customers.

* When an order with age-restricted products is paid (or, in "before purchase" mode, when the customer starts the check in cart or checkout), the plugin sends the order number, the customer's email address, billing and shipping name, the required minimum age, the site language and a return URL to the shop.
* Once an hour, and when an order is opened or cancelled, the plugin requests or cancels the status of open checks.
* When you click "Connect with altersverifikation.ch", the plugin registers itself once as an OAuth client (site name, admin callback URL), sends you to altersverifikation.ch to sign in and choose your shop, and then receives an API key for this site.
* When connecting, the plugin registers its webhook URL; altersverifikation.ch then sends the result of each check to it. When disconnecting, the plugin removes the webhook and revokes its API key.

Terms of service: https://altersverifikation.ch/agb
Privacy policy: https://altersverifikation.ch/datenschutz

== Installation ==

1. Upload and activate the plugin (Plugins → Add New → Upload Plugin).
2. In WooCommerce → Settings → Altersverifikation, click "Connect with altersverifikation.ch", sign in and confirm your shop. The API key and webhook are set up automatically. (Alternatively, create an API key in the dashboard under Integration → API and enter it.)
3. Set the age limit on products (General tab) or product categories.
4. Turn on test mode and place an order.

== Frequently Asked Questions ==

= What happens if the check fails? =

The order moves to "On hold" with a note. Cancel the order and refund the payment as usual.

= Can I release a held order anyway? =

Yes. If you set the order to "Processing" yourself, the plugin does not hold it again.

= Does it work with a staging copy? =

Create a separate shop for the staging site in the altersverifikation.ch dashboard and connect it with that shop's API key, since each shop has one webhook URL. Turn on test mode on the staging site: order numbers get the prefix TEST- and nothing is billed.

= We hand orders to a warehouse or ERP when they reach "Processing". =

The plugin holds an order right after WooCommerce has set it to "Processing" and sent the order emails, so the confirmation link is in the email. Extensions that export orders at that very moment see the order before it is held. Configure the export to skip "Age check pending" (or to wait for confirmed orders), or use the "before purchase" mode.

= We already use the BCC address. =

Remove the BCC address from the order confirmation once the plugin is active. No duplicate checks are created (same order number), but the plugin is the better option.

== Changelog ==

= 0.5.0 =
* New option "Remember in customer account": logged-in customers can agree during the check that later orders with their account are confirmed without Face ID while their verification is valid (12 months). Each order is still checked and logged at altersverifikation.ch. Off by default.
* Cart and checkout show "Age remembered in customer account" (after-order mode); the thank-you page and My account show "Confirmed via your customer account".
* Reset per customer in the WordPress user profile. Turning the option off or deleting the plugin revokes all remembered confirmations at altersverifikation.ch.
* Fix: "before purchase" mode no longer loses a started age check when the checkout page was still loading in the background (the confirmation now always shows up at checkout).

= 0.4.0 =
* Connect with one click: sign in at altersverifikation.ch and choose your shop (OAuth 2.1 with PKCE). No more copying API keys; entering a key still works.
* Each connected site gets its own API key, listed in the dashboard under Integration, where it can be disconnected. Disconnecting in WordPress revokes the key.

= 0.3.0 =
* New look for the age notice in cart, checkout, thank-you page and My account, with the altersverifikation.ch logo.
* Optional footer badge and shortcode [altersverifikation_badge] (light or dark); optional link to the explanation for customers. Both off by default.

= 0.2.1 =
* Fix: block checkout no longer stays in its loading state when the age notice is shown ("before purchase" mode).
* The checkout email field is prefilled with the address used for the age check.

= 0.2.0 =
* Check before the purchase (mode A).
* French and Italian translations.

= 0.1.0 =
* First version.
