Revenue
Connect Stripe, RevenueCat, the App Store and Google Play, and see revenue next to behaviour.
Status
Available Connect providers in the console under Settings → Integrations (or through the API below), and see MRR, movements and revenue in the console's Revenue section.
Revenue arrives from your billing provider's own webhooks, is verified with that provider's proof, normalised to one event model, converted to your project currency, and linked to the person who paid. It then works everywhere events do: as a funnel step, an experiment metric, or a breakdown.
How it fits together
- Create an integration for a provider. You get a webhook URL on your region's ingest host:
https://eu.i.analytics.atrix.dev/wh/{provider}/{token}. - Paste the URL into the provider, and give Atrix the provider's signing secret where it has one.
- Link customers to people from your app with
setRevenueCustomer, so revenue lands on the right person.
The token in the URL only routes the delivery. Authenticity always comes from the provider's own proof, never from the URL.
Create an integration
In the console: Settings → Integrations → Connect, which shows the webhook URL, lets you rotate it, and holds the Google Play price catalogue. The same through the API:
curl -X POST "https://app.analytics.atrix.dev/v1/projects/$PROJECT_ID/integrations" \
-H "Authorization: Bearer $ATRIX_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: stripe-setup-1' \
-d '{ "provider": "stripe", "name": "Stripe live", "secret": "whsec_…" }'The response includes webhook_url. Secrets are sealed with AES-256-GCM and never returned (only
secret_last4). Reads need projects:read; changes need projects:write. PATCH updates name, config,
secret (rotation) or status (active / paused); POST …/rotate-token issues a new URL; DELETE
disconnects. A paused integration acknowledges deliveries without ingesting them.
Per provider
- Create the integration with
"provider": "stripe". - In the Stripe Dashboard, Developers → Webhooks → Add endpoint, paste the
webhook_url, and select the events Atrix reads:invoice.paid,invoice.payment_failed,checkout.session.completed,customer.subscription.created,customer.subscription.updated,customer.subscription.deletedandcharge.refunded. - Copy the endpoint's signing secret (
whsec_…) and set it as the integration'ssecret.
Every delivery is checked against the Stripe-Signature header (HMAC-SHA256) with a 300-second tolerance,
configurable from 60 to 3600 seconds with config.tolerance_secs. Attribution uses your explicit
setRevenueCustomer link, or Checkout's client_reference_id if you set it to the user's id.
Link customers to people
import * as atrix from "@atrix.dev/analytics-web";
// After checkout, with the provider's customer id:
atrix.setRevenueCustomer("cus_Nffrfeu", { provider: "stripe" });This sends a $revenue_customer event for the current user. Every SDK has it (setRevenueCustomer in
JavaScript, set_revenue_customer in Python, SetRevenueCustomer in Go). Links are picked up within about
30 seconds, and revenue that arrived before the link is attributed retroactively.
What you get
- Event types:
initial_purchase,renewal,trial_started,trial_converted,cancellation,refund,billing_issue,product_change,one_time_purchase. Redelivered webhooks never double count. - Currency: amounts are converted into your project currency and USD with the European Central Bank's daily reference rate for the event date, in integer minor units. Currencies the ECB does not publish (for example PKR and AED) are kept in their original currency with the rate recorded as unknown.
- A
$revenueevent on the paying person, with$revenue_minor,$currency,$revenue_event_type,$revenue_provider,$product_idand$subscription_id, so revenue works in funnels, trends and experiments. - Revenue insights through the query API:
mrr,arr,mrr_movements(new, reactivation, expansion, contraction, churned),revenue(gross, refunds, net),arpu,arppu,ltvby signup cohort, andrefund_rate, with breakdowns by product, country, platform, store or provider. - SQL: the
revenue_eventstable; see SQL.