=== AI 402 Monetization ===
Contributors: davidebordigoni
Tags: monetization, http-402, ai-protection, copyright-tdm, pay-as-you-go, euro
Requires at least: 5.6
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Monetize AI agent scraping with HTTP 402 micro-settlements and enforce EU Copyright Art. 4 TDM Opt-Out in EUR (€).

== Description ==

**AI 402 Monetization** is the EU-native HTTP 402 pay-as-you-go monetization plugin for digital publishers, news portals, and content creators facing unauthorized AI scraping from crawlers like GPTBot, PerplexityBot, ClaudeBot, and Bytespider.

= EU Compliance Engine (the core) =

* **EU Copyright Directive Art. 4(3) TDM Opt-Out:** Automatically injects the machine-readable `TDM-Reservation: 1` header on every response. Per the Hamburg OLG ruling (5 U 104/24, Dec 2025), natural-language ToS opt-outs are NOT sufficient — reservations must be machine-actionable. This plugin makes them so.
* **W3C TDMRep JSON-LD:** Auto-serves `/.well-known/tdmrep.json` directly from WordPress.
* **EU AI Act Art. 50/53 Transparency Manifest:** Auto-serves `/.well-known/ai-act-transparency.json` documenting data provenance and TDM reservation for AI model providers operating in the EU.
* **Euro (€ EUR) Standard:** Native European pricing model standardizing at €0.005 EUR per AI query.

= Monetization Gateway =

* **Dual Mode Execution (Shadow & Enforce):** Run in passive Shadow Mode to monitor bot traffic with zero SEO risk, or switch to Enforce Mode to monetize crawling via HTTP 402.
* **HTTP 402 Pay-As-You-Go Challenges:** Intercepts AI crawler user-agents and issues standardized `402 Payment Required` challenges with `WWW-Authenticate: L402` and x402 Foundation payment metadata (€0.005 EUR default per article).
* **Token-Optimized Markdown Engine:** Automatically strips HTML boilerplate, navigation, and ads, delivering clean Markdown with C2PA provenance signatures (`X-Content-Provenance`) upon payment.
* **Centralized Cryptographic Verification:** Payment proofs and prepaid API keys are validated server-to-server against the ai402.eu clearinghouse.
* **Remote Policy Management:** Syncs Shadow/Enforce mode and price dynamically from the ai402.eu publisher dashboard.
* **0% Impact on Human Readers & Search Crawlers:** Real human visitors and Googlebot/Bingbot access your content normally with zero latency penalty.
* **Automated Monthly SEPA Payouts:** Enter your IBAN to receive direct bank transfer payouts (€10 minimum threshold).

== External services ==

This plugin connects to external web services operated by ai402.eu in the following specific scenarios:

1. **Crawler Telemetry Ping (Passive & Enforce):**
   * **Service:** AI 402 Publisher Telemetry & Observability Network (https://api.ai402.eu)
   * **Endpoint:** `https://api.ai402.eu/api/v1/telemetry/ping`
   * **Purpose:** Sends non-blocking, asynchronous telemetry pings when synthetic AI crawlers access the site so publishers can monitor real-time AI indexing volume on their ai402.eu dashboard.
   * **Terms of Service & Privacy Policy:** https://ai402.eu/privacy.html

2. **Payment Proof & Credit Verification (Transactional):**
   * **Service:** AI 402 Micro-Settlement & Payment Verification Network (https://api.ai402.eu)
   * **Endpoint(s):** `https://api.ai402.eu/api/verify-proof` and `https://api.ai402.eu/api/v1/credits/debit`
   * **Purpose:** Validates cryptographic HMAC-SHA256 tokens (x402/L402) and debits prepaid API keys when a paying AI agent requests an article. No visitor personal data is sent.
   * **Terms of Service & Privacy Policy:** https://ai402.eu/privacy.html

3. **Remote Policy & Configuration Sync:**
   * **Service:** AI 402 Publisher Policy API (https://api.ai402.eu)
   * **Endpoint:** `https://api.ai402.eu/api/v1/policy`
   * **Purpose:** Fetches the active publisher policy (Shadow vs Enforce mode and per-article price) configured in the ai402.eu dashboard, cached locally in WordPress transients for 60 seconds.
   * **Terms of Service & Privacy Policy:** https://ai402.eu/privacy.html

4. **Publisher Onboarding & Payout Setup (Explicit Opt-In):**
   * **Service:** AI 402 Publisher Onboarding Gateway (https://api.ai402.eu)
   * **Endpoint:** `https://api.ai402.eu/api/onboarding`
   * **Purpose:** Transmits publisher account data (contact email, company name, VAT/Tax ID, SEPA IBAN) to register the payout profile when the administrator explicitly checks the GDPR consent box and saves settings in wp-admin.
   * **Terms of Service & Privacy Policy:** https://ai402.eu/privacy.html

== Installation ==

1. Upload the `ai-402-monetization` directory to the `/wp-content/plugins/` directory, or install the plugin directly through the WordPress plugins screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Navigate to **Settings -> AI 402 Monetization** in your WordPress admin dashboard.
4. Select your operational mode (**Shadow Mode** for passive monitoring or **Enforce Mode** for active monetization).
5. Enter your contact email and SEPA IBAN for direct monthly payouts.
6. Click **Salva Impostazioni Monetizzazione**.

== Frequently Asked Questions ==

= Does this block human visitors or require them to pay? =
No! Human visitors browse your website 100% free with zero interruptions. The HTTP 402 challenge ONLY triggers for synthetic AI web scrapers.

= Will this hurt my Google SEO rankings? =
No. Googlebot and standard search engine crawlers are explicitly whitelisted and served normally. In Shadow Mode, AI bots are also served normally with legal TDM headers.

= How do payouts work? =
Accumulated micro-settlements are aggregated and transferred directly to your bank account via automated SEPA wire transfer on the 1st of every month.

= Where are the compliance files served? =
`https://yourdomain.com/.well-known/tdmrep.json` and `https://yourdomain.com/.well-known/ai-act-transparency.json` — they are generated automatically on WordPress.

== Screenshots ==

1. Admin Dashboard — Real-time crawler metrics in EUR (€), estimated revenue, bandwidth savings, and SEPA payout settings.
2. HTTP 402 Challenge Payload — Standardized JSON response returned to synthetic AI bots with EUR pricing.

== Changelog ==

= 1.3.0 =
* Complete migration to EUR (€) standard currency (€0.005 default per article).
* Added real-time non-blocking telemetry stream to Publisher Suite Dashboard.
* Enhanced W3C TDMRep and EU AI Act Art. 50/53 provenance tags.
* Full compatibility with WordPress 6.x and PHP 8.x.

= 1.2.0 =
* Integrated Real-Time Local Publisher Dashboard in wp-admin.
* Added Shadow Mode vs Enforce Mode operational toggle.
* Added native Token-Optimized Markdown delivery engine for paying AI agents with C2PA provenance headers.

= 1.1.0 =
* Centralized payment-proof verification against ai402.eu gateway.
* Added `/.well-known/tdmrep.json` (W3C TDMRep) auto-generation.
* Added `/.well-known/ai-act-transparency.json` (EU AI Act Art. 50/53).

= 1.0.0 =
* Initial official release.
