=== Advanced Ads Seller ===
Contributors: dizwebdesign
Tags: ads, advanced-ads, stripe, square, amazon-pay, ecommerce
Requires at least: 6.5
Requires PHP: 7.4
Stable tag: 0.5.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sell ad placements without WooCommerce. Requires the free Advanced Ads plugin.

== Description ==

* Dashboard with dependency status, store page summary, and “Run update & sync”.
* Settings: public store page (`[aas_store_front]`), donations page (`[aas_donations]`), pricing (currency, tax, per-impression), Stripe credentials, receipts (company letterhead, optional HTML templates), ad sizes.
* Commerce: impression packages, unlimited subscription catalog, donation tiers, coupons (ads only), orders, sponsor review; **Stripe Billing** (recurring Prices + Checkout `subscription` mode for unlimited and sponsor tiers; Checkout `payment` mode for one-time Stripe impressions) plus REST webhooks; optional Square and Amazon Pay for one-time impression purchases (Amazon Pay checkout signing requires PHP 8+).
* Tools: migrations, page sync, bulk customer role resync, debug links; backup and restore of plugin options (including role and blocklist-related settings).
* Trust & safety: activity log (filters), sponsor/advertiser directory (split lists), refund requests (required admin notes; linked orders can be marked refunded on approve), user blocklist (edit stored reason); `[aas_refund_request]` shortcode (not available when blocklisted); activity entries when sponsor/advertiser **role slugs** change in Settings.
* Roles: customer roles resync after ad/sponsor DB writes; Tools bulk resync unchanged.
* Donations (`[aas_donations]`): abandon sponsor rows stuck in pending payment (clears linked pending order).
* Admin debug: append `?aas_debug=1` or `?plugin_debug=1` to a wp-admin URL (manage users with `manage_options` only).

== Installation ==

1. Install and activate **Advanced Ads** (free) from WordPress.org.
2. Upload and activate Advanced Ads Seller.
3. Open Advanced Ads Seller → Settings, then Tools → Run update & sync pages.

== Frequently Asked Questions ==

= Does this replace WooCommerce? =

It is intended as a dedicated ad-sales stack alongside Advanced Ads, not a general store. Recurring plans use **Stripe Billing** (Dashboard Products/Prices and Checkout in subscription mode). One-time impressions can check out with Stripe, or with Square / Amazon Pay when enabled.

= Is Advanced Ads Pro required? =

No. Pro is optional; this plugin checks for the free Advanced Ads plugin.

= Who pays Stripe fees? =

Stripe charges your merchant account according to their published pricing. Customer-facing prices in the plugin are before those fees unless you price to absorb them. See **Settings → Stripe** for a link to official pricing.

= How do I configure Stripe webhooks for renewals and cancellations? =

In **Stripe → Developers → Webhooks**, add the REST URL shown under **Advanced Ads Seller → Tools** (Debug). Enable events including `checkout.session.completed`, `customer.subscription.updated`, `customer.subscription.deleted`, and `invoice.payment_failed` so the plugin can finalize checkout, mirror subscription end in WordPress, and log failed renewals.

== Changelog ==

= 0.5.1 =
* Settings and readme: clarify **Stripe Billing** (recurring Prices + Checkout subscription mode) vs one-time checkout; document recommended webhook event types.
* Stripe webhook handler: `customer.subscription.deleted`, terminal `customer.subscription.updated` statuses, and `invoice.payment_failed` (activity log); sync paused ads and cancelled sponsor orders when Stripe ends a subscription.
* DB v10: index on `aas_orders.stripe_subscription_id` for webhook lookups.

= 0.5.0 =
* Optional **Square** (payment links) and **Amazon Pay** (Checkout v2) for **one-time impression** purchases; unlimited subscriptions and sponsor donations remain **Stripe** only.
* Orders table: `square_order_id`, `square_payment_id`, `amazon_checkout_session_id`; DB migration v9; settings fields and backup/uninstall option keys for new gateways.

= 0.4.0 =
* **Breaking:** PayPal integration removed. Checkout and subscriptions are Stripe-only. PayPal settings and product “plan” fields are removed from the UI; uninstall still deletes legacy PayPal options if present.

= 0.3.2 =
* Customer roles: `sync_user` runs from ad/sponsor model writes (create/update/bulk cancel); optional quiet sync without `role_sync` log for ad create and sponsor create / order-id-only sponsor updates.
* Settings: changing sponsor or advertiser **role slug** writes an activity-log entry (`settings_role_sponsor` / `settings_role_advertiser`).
* Donations page: list **pending payment** sponsor applications with **Abandon** (cancels submission and any linked **pending** order).

= 0.3.1 =
* Refunds: require admin note on approve/reject; on approve, linked orders in pending/processing/paid are marked refunded in the plugin; blocklisted users can no longer submit `[aas_refund_request]`.
* Blocklist: edit active block’s stored reason with a mandatory audit note (logged).
* Directory: separate Sponsors vs Advertisers tables; Activity log: optional event prefix and subject user filters.
* Settings: sponsor/advertiser role pickers exclude Administrator (saving Administrator falls back to defaults).

= 0.3.0 =
* Customer roles (sponsor / advertiser) synced from approved sponsors and active or paused ads; Settings uses dropdowns of all WordPress roles (plus Tools → bulk resync).
* Blocklist with required reasons, activity log, refund requests (user shortcode `[aas_refund_request]` + admin approve/reject with optional block and optional product sweep; admin follow-up notice only when both block and sweep run).
* Stripe subscription cancel from My Ads and from the donations page for sponsor billing; pre-payment policy checkboxes on store and donation checkout.
* Admin: Activity log, Directory (expandable user rows), Refund requests, Blocklist; Settings contact email for blocked customers; backup allowlist extended.

= 0.2.9 =
* `[aas_ad]` and ad click tracking: only **active** ads render publicly and count clicks/impressions; pending (and paused/draft) ads no longer appear to visitors.
* Logged-in ad owners embedding a non-active ad see a short notice that the ad awaits administrator approval before public display.
* My Ads: note that pending ads stay off the public site until an admin sets them active.

= 0.2.8 =
* Settings → Receipts & acknowledgments: company information for seller letterhead, send toggle and From name/email, nonprofit/donation fields, donor profile meta keys, and optional HTML templates (placeholders) for ad purchase and donation emails.
* Load receipt mailer on bootstrap; send receipt/acknowledgment after successful order fulfillment (idempotent).

= 0.2.7 =
* Admin UI: plugin buttons use centered uppercase labels, stronger rounded corners, and light shading/gradients (including ThickBox modals); focus ring preserved for keyboard access.

= 0.2.6 =
* Settings → Ad sizes: manage sizes outside the main settings form with Add / Edit (ThickBox modals) and Delete actions; avoids losing sizes when saving other settings.

= 0.2.5 =
* Products admin: clearer layout (region panels, scrollable tables, toolbars for add actions), donation section accent, empty-state hints, and padded ThickBox modal shells for readability and small screens.

= 0.2.4 =
* Products admin: prices are entered/displayed as dollars (stored as cents) and the Products screen uses modal forms (ThickBox) with clear Paid ads vs Donations separation.

= 0.2.3 =
* Store front (`[aas_store_front]`): stop running the checkout form through `wp_kses_post()` (it stripped most fields so buyers often only saw the text area). Enqueue `store-front-form.js` for purchase mode + ad type toggles.
* Store form: ad type is a select (text vs image); show/hide body vs image upload with correct `required` flags.

= 0.2.2 =
* Fix fatal error: remove duplicate `AAS_Coupons::get()` method in `class-aas-coupons.php` (merge artifact).

= 0.2.1 =
* Settings: notice under Stripe explaining processing fees (with link to official pricing).
* Settings: clarify Stripe credentials are used for checkout and webhooks.

= 0.2.0 =
* Commerce tables (orders, packages, subscriptions catalog, coupons, donation tiers, sponsor submissions) with DB v6 migration.
* Store checkout: impressions or unlimited subscription; server-side pricing + optional coupons; Stripe Checkout.
* Donations shortcode/page sync: sponsor tiers, Stripe subscription checkout, post-payment admin review before public `[aas_sponsors]` wall.
* REST Stripe webhook endpoint `aas/v1/stripe-webhook`.
* Admin: Products, Coupons, Orders, Sponsors screens; pricing + donations page settings.

= 0.1.0 =
* Initial release: scaffold, settings (Stripe), tools, backup, debug.
