MenuWooCommerce

Revenue attribution

WooCommerce

Connect WooCommerce with a read-only REST API key and signed webhooks so ProductLense records orders and refunds and attributes each buyer.

ProductLense reads your WooCommerce orders and refunds and attributes each buyer to the channel that first brought them. Core WooCommerce orders are one-off purchases, so there are no subscriptions. ProductLense only reads: it never writes to your store, never refunds, cancels or changes anything.

What you need

FieldSecretWhere to find it
Store URLNoYour store's https:// address, for example https://shop.example.com. Include the folder if WordPress lives in one (https://example.com/shop).
Consumer keyNoThe ck_... key from WooCommerce → Settings → Advanced → REST API, created with Read permission.
Consumer secretYesThe cs_... secret shown once with the key.
Webhook secretYesA secret you type on each webhook you add in WooCommerce.

The store must be served over HTTPS on the standard port: ProductLense sends the key with HTTP Basic auth and never over plain HTTP.

Every plan includes one billing connection per site, Free too; Growth and Scale allow any number. See plans and limits.

Permissions

Create the REST API key with Read permission only. ProductLense calls the WooCommerce REST API v3: GET /wp-json/wc/v3/orders (every status, 100 a page) and GET /wp-json/wc/v3/orders/<id>/refunds for orders that have refunds.

Set up

  1. In WordPress, open WooCommerce → Settings → Advanced → REST API → Add key. Pick a user that can see orders, set Permissions to Read, and copy the consumer key and secret.
  2. In ProductLense, open your site's Settings → Billing connections → WooCommerce, enter the store URL, key and secret, check the Processor fees estimate, and click Connect and import history.
  3. Copy the webhook URL from the connection card.
  4. In WooCommerce → Settings → Advanced → Webhooks, add three webhooks with that delivery URL, status Active, API version WP REST API Integration v3 and the same secret on each: Order created, Order updated and Order restored. Paste the secret into the connection in ProductLense.
  5. Install the ProductLense Analytics WordPress plugin and turn on WooCommerce in its settings.

Webhook

URL: https://api.productlense.app/api/webhooks/woocommerce/<connection-id> (ProductLense shows the exact URL after you save).

Topics ProductLense uses:

  • order.created, order.updated, order.restored

WooCommerce has no refund webhook: a refund changes the order, which fires Order updated with the refund on it. Other topics, and the test delivery WooCommerce sends when you save a webhook, are acknowledged and ignored.

Verification: the X-WC-Webhook-Signature header, a base64 HMAC-SHA256 of the raw body with your webhook secret. The X-WC-Webhook-Source header must also name the connection's store, so one connection never accepts another store's orders. A repeated delivery of the same order is processed once.

What ProductLense reads

  • Customers: registered customers by id; guest checkouts are grouped by billing email. Name, email and billing country.
  • Payments: orders that are processing, completed or refunded count as revenue, at the order total (tax and shipping included), on the date paid. Failed orders are kept as failed and add nothing. Pending, on-hold and cancelled orders are not payments.
  • Refunds: every refund on an order, dated when it was made.
  • Subscriptions: none.
  • History: the last 12 months on first connect, then a nightly reconcile at 03:00 UTC from the last sync minus 48 hours.

Amounts stay in the order currency and are also converted to USD at the European Central Bank rate for the payment's day.

How fees are derived

WooCommerce does not record processor fees: your payment gateway (Stripe, PayPal, WooPayments and others) charges them. Every order arrives with a fee of 0, and ProductLense subtracts the connection's estimate instead. It starts at 2.9% + $0.30, a common card rate; change it under Processor fees on the connection card to your gateway's rate. Estimated fees are flagged, and the dashboard shows the share of fees in a period that is estimated.

Match payments to visitors

The ProductLense Analytics plugin links each order to its visitor in two ways, so revenue lands on the right channel:

  • At checkout it adds a hidden field filled with the visitor's ProductLense id and saves it on the order as _pl_visitor_id. ProductLense reads it from the order.
  • On the order received page it calls productlense('checkout', 'woocommerce', '<order key>'), which links the order key to the visitor even if the hidden field was missed.

The hidden field works with the classic checkout (the [woocommerce_checkout] shortcode). The block checkout skips it, and the order received page link still applies. Without either, ProductLense falls back to the billing email, matched to the email trait sent with identify.

Limits

  • Only the order total is read; line items and coupons are not.
  • Orders created more than 12 months before connecting are not imported.
  • WooCommerce Subscriptions renewals arrive as ordinary orders and count as payments, not MRR.

    ↑ ↓ to move, Enter to open