You are helping integrate LinkJolt affiliate tracking into a WooCommerce (WordPress) store that uses the WooCommerce Stripe Payment Gateway.

## Context
- Merchant ID: YOUR_MERCHANT_ID
- Platform: WooCommerce on WordPress
- Required gateway: WooCommerce Stripe Payment Gateway (the official one — not third-party forks)
- Webhook Endpoint: https://www.linkjolt.io/api/webhooks/stripe/merchant/YOUR_MERCHANT_ID

## Install the LinkJolt WordPress plugin

1. Download: https://www.linkjolt.io/downloads/linkjolt-tracking.zip
2. In WP Admin → Plugins → Add New → Upload Plugin → select the `.zip` → "Install Now" → "Activate".
3. In WP Admin → Settings → LinkJolt Tracking, paste the Merchant ID: `YOUR_MERCHANT_ID`.
4. Confirm:
   - WooCommerce is active.
   - WooCommerce Stripe Payment Gateway is active (https://wordpress.org/plugins/woocommerce-gateway-stripe/).

The plugin hooks into `wc_stripe_intent_metadata` / `wc_stripe_payment_metadata` / `wc_stripe_payment_intent_args` filters and injects cookie-sourced tracking data as keys on the Stripe PaymentIntent metadata (`linkjolt_tc`, `linkjolt_aff`, `linkjolt_cid`, `linkjolt_customer_email`, and when WooCommerce Subscriptions is active, `linkjolt_subscription_id`).

The plugin also auto-declares HPOS compatibility so it works on WooCommerce 9.0+ with High-Performance Order Storage enabled.

## Stripe Dashboard webhook

1. https://dashboard.stripe.com/webhooks → Add endpoint
2. URL: `https://www.linkjolt.io/api/webhooks/stripe/merchant/YOUR_MERCHANT_ID`
3. Select events:
   - `payment_intent.succeeded` (PRIMARY for WooCommerce — attribution reads PaymentIntent metadata)
   - `charge.refunded` (refund commission reversal)
   - `invoice.payment_succeeded` + `customer.subscription.updated` + `customer.subscription.deleted` (only if using WooCommerce Subscriptions)
4. Save Signing Secret (`whsec_*`) in LinkJolt → Settings → Payment Providers (provider: stripe).

## How It Works

1. Visitor clicks affiliate link → arrives on WP site.
2. Tracking script (auto-injected by the plugin) stores cookies `linkjolt_tc` / `linkjolt_aff` / `linkjolt_cid`.
3. Visitor checks out with WooCommerce → WC Stripe Gateway builds a PaymentIntent.
4. Plugin reads cookies server-side + appends them to PaymentIntent metadata.
5. Stripe fires `payment_intent.succeeded` → LinkJolt matches `linkjolt_tc`/`linkjolt_aff` → conversion row inserted.

## Common issues

- "No conversions despite clicks" → check WP Admin → Settings → LinkJolt Tracking: "LinkJolt tracking is active" banner must be green. If it's not, WC Stripe Gateway is likely not active.
- "Non-Stripe gateway" → PayPal, Square, Klarna, etc. are NOT supported. Attribution relies on the WC Stripe Gateway filter hooks.
- "Third-party Stripe gateway" → alternatives like "Payment Plugins Stripe for WooCommerce" use different filter names and are NOT supported.
- "HPOS warning in admin" → upgrade to plugin v1.1.0+ (auto-declares HPOS compatibility).
