Stripe analytics: revenue by channel
ProductLense connects to Stripe and attributes every payment, refund and renewal to the channel, campaign and landing page that first brought the customer. Charges, subscriptions, refunds and disputes from Stripe, with the exact fee from each balance transaction.
Setup steps
- In Stripe, open Developers → API keys and create a restricted key with Read on Customers, Subscriptions, Charges, Refunds and Balance transactions.
- In ProductLense, open Settings → Billing connections → Stripe and paste the key. ProductLense makes one read call to check it.
- In Stripe → Developers → Webhooks, add a webhook endpoint with the URL ProductLense shows after you save the connection (pattern https://api.productlense.app/api/webhooks/{provider}/{connection_id}).
- Select the events listed below, save, and paste the signing secret into ProductLense.
- ProductLense backfills the last 12 months, then keeps up through webhooks and a nightly reconcile.
Credentials and permissions
| Field | Secret | Where to find it |
|---|---|---|
| Secret key | Yes, encrypted at rest | A restricted key (rk_live_...) with read access to customers, subscriptions, charges, refunds and balance transactions. A full secret key also works; a restricted key is safer. |
| Webhook signing secret | Yes, encrypted at rest | The whsec_... secret of the webhook endpoint you point at ProductLense. |
Webhook
URL pattern, shown with your connection id after you save:
https://api.productlense.app/api/webhooks/stripe/{connection_id}Events: charge.succeeded, charge.refunded, charge.dispute.created, customer.created, customer.updated, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, invoice.paid
Verification: Stripe-Signature header: timestamp plus HMAC-SHA256, rejected after 5 minutes.
What ProductLense reads
- Customers
- Customers, including email and metadata such as pl_user_id.
- Subscriptions
- Subscriptions with plan, interval and status.
- Payments
- Charges and paid invoices.
- Refunds
- Refunds, plus disputes recorded as chargebacks.
- Fees
- The fee on each balance transaction, and the dispute fee on chargebacks.
What ProductLense never touches
- Never creates, changes, refunds or cancels anything: read-only API calls and incoming webhooks only.
- Never moves money, issues payouts, or reads bank account details.
- Never sees full card numbers; providers do not expose them.
- Never sends your customer data to the AI model: Ask and the daily insight see aggregates only.
Match payments to your users
Set metadata.pl_user_id on Stripe customers to the same id you pass to identify for the strongest match. Without it, ProductLense matches by customer email.
const customer = await stripe.customers.create({
email: user.email,
metadata: { pl_user_id: user.id },
});Stripe and ProductLense: questions
- Does ProductLense work with Stripe?
- Yes. ProductLense connects to Stripe with secret key, webhook signing secret, backfills 12 months of history, and stays current through signed webhooks plus a nightly reconcile. One connection is included on Starter; Growth and Scale allow every provider at once on the same site.
- What data does ProductLense read from Stripe?
- Customers, subscriptions, payments, refunds and fees, read-only. Payments: charges and paid invoices. Refunds: refunds, plus disputes recorded as chargebacks. Fees: the fee on each balance transaction, and the dispute fee on chargebacks.
- Can ProductLense change anything in my Stripe account?
- No. ProductLense only makes read calls and receives webhooks. It never creates, changes, refunds or cancels anything, never moves money, and never sees card numbers. Credentials are encrypted at rest, and the AI features only ever see aggregated numbers, never your customers’ data.
- How does ProductLense match Stripe payments to visitors?
- Set metadata.pl_user_id on Stripe customers to the same id you pass to identify for the strongest match. Without it, ProductLense matches by customer email. Your site calls identify with the same user id after signup, and ProductLense follows the payment to that visitor’s first touch: source, medium, campaign and landing page.
- Are Stripe fees subtracted from revenue?
- The fee on each balance transaction, and the dispute fee on chargebacks. Net revenue is the charge minus the fee; refunds subtract the refunded amount and its fee. Profit per channel then subtracts ad spend.
Connect Stripe and see revenue by channel today.
Add the script, connect Stripe or any of 14 other billing providers, and see revenue by channel the same day.