← Blog

How to track MRR from Stripe webhooks in 5 minutes

Monthly recurring revenue is the number every indie SaaS founder checks first — but wiring it into Datadog or Grafana often means agents, billing surprises, and an afternoon lost to YAML. If you already send Stripe webhooks to your app, you can log MRR to Umlogger in about five minutes with one HTTP call per event.

What we're building

When Stripe fires invoice.paid or customer.subscription.updated, your webhook handler already knows the new MRR. We'll push that number to a value metric in Umlogger so you get a chart, alerts, and a line in your daily email digest — no data warehouse required.

1. Create the metric

Sign up, open the console, and create a metric named MRR with type value. Copy the per-metric public key (pmk_…) from the detail page — you'll use it in the webhook handler.

2. Handle the Stripe webhook

Below is a minimal Express handler. It computes MRR in cents from active subscriptions (simplified for the tutorial — adjust to match your Stripe objects and proration rules).

import express from "express";

const app = express();
app.post(
  "/webhooks/stripe",
  express.raw({ type: "application/json" }),
  async (req, res) => {
    // Verify Stripe signature in production (stripe.webhooks.constructEvent)
    const event = JSON.parse(req.body.toString());

    if (
      event.type === "invoice.paid" ||
      event.type === "customer.subscription.updated"
    ) {
      const mrrCents = await calculateMrrCents(); // your DB or Stripe API
      await reportMrr(mrrCents / 100);
    }

    res.json({ received: true });
  }
);

async function reportMrr(dollars: number) {
  const url = new URL("https://data.umlogger.com/api/m");
  url.searchParams.set("key", process.env.UMLOGGER_MRR_KEY!);
  url.searchParams.set("value", String(dollars));
  const res = await fetch(url);
  if (!res.ok) throw new Error(`Umlogger ingest failed: ${res.status}`);
}

app.listen(3000);

Environment variables

  • UMLOGGER_MRR_KEY — your pmk_… key from the console
  • Stripe signing secret for webhook verification (omitted above for brevity)

3. Send a test sample

Before going live, curl a sample from your laptop:

curl "https://data.umlogger.com/api/m?key=pmk_YOUR_KEY&value=4200"

Open the MRR metric in the console — you should see the point on the chart. Turn on Include in daily emailso tomorrow's digest includes the latest value.

4. Add a sanity-check alert

On the metric detail page, add an alert for "average below" a threshold (e.g. if MRR drops more than you expect after a bad week). Umlogger emails your org when the rule fires — no PagerDuty SKU required.

Why not spreadsheets or BigQuery?

Sheets work until you want history, alerts, and a chart without maintaining a pipeline. Enterprise observability tools charge per custom metric and expect an agent. For indie SaaS metrics, a webhook → HTTP ingest loop is enough: Stripe tells you the truth, Umlogger remembers it.

More ingest patterns live in the API docs. Flat pricing is on the pricing page — $1/month, unlimited metrics, 42-day trial.