=== Pay By AI for WooCommerce ===
Contributors: paybyai
Tags: woocommerce, ai, agents, mcp, payments
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Let AI agents browse your WooCommerce store and pay for orders on behalf of their users. Payments settle through Pay By AI.

== Description ==

Pay By AI for WooCommerce exposes your store as an MCP (Model Context Protocol) server. Any AI agent — Claude, GPT, a custom agent — can discover your store, search products, and place real orders. Payments settle through Pay By AI's non-custodial wallet: funds route directly from the customer's card to your Stripe account.

**How it works**

1. You install the plugin and paste your Pay By AI merchant API key under *WooCommerce → Settings → Pay By AI*.
2. The plugin advertises an MCP endpoint at `https://yourshop.com/wp-json/paybyai/v1/mcp` and a discovery manifest at `https://yourshop.com/.well-known/pay-by-ai.json`.
3. When an agent visits on a user's behalf, it can call `search_products`, `get_product`, and `checkout`. The `checkout` tool creates a pending WooCommerce order and mints a Pay By AI payment token.
4. The agent pays the token through Pay By AI's central payment MCP. Once Stripe confirms the payment, Pay By AI webhooks this plugin, and the order is marked paid — fulfillment kicks in automatically.

**Requirements**

* WordPress 6.5+
* WooCommerce 8.5+
* PHP 7.4+
* A Pay By AI merchant account (sign up at https://www.paybymyai.com/merchant)

== Installation ==

1. Upload the plugin ZIP via *Plugins → Add New → Upload Plugin*, or place the folder in `wp-content/plugins/`.
2. Activate the plugin.
3. Go to *WooCommerce → Settings → Pay By AI* and paste your merchant API key (starts with `pbai_mk_`).
4. The plugin will verify the key, cache your merchant id, and set your Pay By AI webhook URL to point at this site automatically.

== Frequently Asked Questions ==

= Does this replace my normal checkout? =

No. Regular customers still use WooCommerce's standard checkout. This plugin adds a second, parallel path for AI agents.

= Do I need Shopify Payments or anything special? =

No. Payments route through Pay By AI → Stripe → your connected Stripe account. You keep your existing Stripe integration.

= Can an agent spend unlimited amounts? =

No. Every agent session on Pay By AI has spending caps and merchant allowlists set by the user. Your store also sees the full order in the WooCommerce admin before fulfillment.

== Changelog ==

= 0.1.0 =
* Initial release: MCP endpoint with `search_products`, `get_product`, `checkout`; Pay By AI webhook receiver; discovery via `<link rel>` + `.well-known`.
