=== Abovault – SEPA Subscriptions & Dunning for WooCommerce ===
Contributors: famosmedia
Tags: woocommerce, subscriptions, sepa, dunning, recurring payments
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

SEPA Direct Debit subscriptions for WooCommerce, with automatic dunning and cancellation retention. Subscription data is stored in your own database.

== Description ==

Abovault adds SEPA Direct Debit subscriptions to WooCommerce. SEPA Direct Debit is offered as a payment method at checkout, renewals are charged automatically off-session, failed payments are handled with a configurable dunning process (payment retries plus reminder emails), and customers who cancel can be sent a retention flow. Subscription data is stored in your own WordPress database.

= Features =

* SEPA Direct Debit (Lastschrift) via Stripe. Mandates are created at checkout and stored on your site.
* SEPA-aware dunning. A SEPA charge settles over several days and can be returned later, so a renewal is treated as pending until Stripe confirms it; the retry cascade and reminder emails only start when a charge actually fails. Retries, backoff and a grace period are configurable.
* Cancellation retention. Before a cancellation, subscribers can be offered a pause or discount; after cancellation, a win-back sequence with an auto-generated coupon can be sent.
* Lifecycle emails. Failed payment, renewal reminder, expiry, win-back and loyalty emails are sequence-driven and translatable (English and German included).
* Data stored locally. Every subscription, mandate reference and lifecycle record lives in your WordPress database.
* Classic and Block checkout. Works in the WooCommerce Cart/Checkout blocks and the classic shortcode checkout.

= How it works =

1. Mark any product as a subscription (interval, period, optional free trial) in the product editor.
2. At checkout the customer authorises a SEPA mandate (Stripe Elements IBAN field).
3. An hourly job renews due subscriptions off-session; a Stripe webhook confirms each SEPA charge.
4. On a failed charge, the dunning cascade + emails run automatically. On cancellation, the retention flow runs.

= Requirements =

* WooCommerce 8.0+
* A Stripe account with SEPA Direct Debit enabled (test or live)
* PHP 8.1+

Payment data is processed by Stripe ([privacy policy](https://stripe.com/privacy) and [terms](https://stripe.com/legal)). Abovault does not send your subscription data to any third party — it stays on your site.

== Installation ==

1. Install and activate **WooCommerce** first.
2. Upload the Abovault plugin and activate it. Tables and the recurring jobs are created automatically (via Action Scheduler, bundled with WooCommerce).
3. Go to **WooCommerce &rarr; Settings &rarr; Payments &rarr; SEPA Direct Debit** and enter your Stripe Publishable Key, Secret Key and Webhook Signing Secret, then enable it.
4. In Stripe, add a webhook endpoint pointing to `https://your-site/wp-json/abovault/v1/stripe-webhook` for the events `payment_intent.succeeded`, `payment_intent.payment_failed` and `setup_intent.succeeded`.
5. **If your site is behind Cloudflare, a WAF, a firewall or a security plugin, allow the webhook path.** CDNs such as Cloudflare (Bot Fight Mode / WAF) reject server-to-server POST requests with HTTP 403 (`error 1010`) and will silently drop Stripe's webhooks &mdash; SEPA charges then never confirm and dunning misfires. Add an allow/skip rule for the exact path `/wp-json/abovault/v1/stripe-webhook` (or allowlist Stripe's published IP ranges). Confirm delivery in **Stripe &rarr; Developers &rarr; Webhooks** (expect HTTP 200 for a signed request).
6. Edit a product &rarr; **Product data &rarr; General** &rarr; tick **Subscription product** and set the interval / trial.
7. Configure the grace period, retries and retention under **WooCommerce &rarr; Abovault**.

== Frequently Asked Questions ==

= Which payment methods are supported? =

SEPA Direct Debit via Stripe in this version. The gateway layer is provider-agnostic internally, so additional processors can be added.

= Where is my subscription data stored? =

In your own WordPress database (`wp_abovault_subscriptions` and `wp_abovault_enrollments`). Only the payment itself is handled by Stripe.

= How does dunning handle SEPA's delay? =

A renewal charge stays *pending* until Stripe's webhook confirms it. Reminder emails and retries only fire when a payment truly fails, so customers are never chased during normal SEPA settlement.

= My Stripe webhooks aren't arriving. What should I check? =

Webhooks are how SEPA charges are confirmed, so delivery matters. Make sure the endpoint `https://your-site/wp-json/abovault/v1/stripe-webhook` is reachable from the public internet and returns HTTP 200 for a signed request. The most common blockers are a firewall, a security plugin, or a CDN/proxy such as Cloudflare (Bot Fight Mode / WAF) rejecting non-browser POST requests. If so, add an allow/skip rule for that path (or Stripe's IP ranges). You can confirm delivery in the Stripe Dashboard under Developers → Webhooks.

= Is it GDPR-friendly? =

Data sovereignty is a design goal: subscription records never leave your server. You remain the controller; Stripe is your payment processor.

== Screenshots ==

1. SEPA Direct Debit at checkout — IBAN mandate via Stripe Elements.
2. Mark any product as a subscription with interval and trial.
3. Dunning, grace period and retention settings.
4. A localized dunning email (German shown).

== Changelog ==

= 0.1.0 =
* Initial release: standalone SEPA subscriptions engine for WooCommerce.
* SEPA Direct Debit checkout (classic + Block), mandate creation and storage.
* SEPA-aware dunning cascade with grace period and reliable async webhook handling.
* Cancellation retention + win-back sequences with auto-generated coupons.
* Localized lifecycle emails (English + German).

== Upgrade Notice ==

= 0.1.0 =
First public release.
