Stripe Webhooks vs API Polling for a Metrics Dashboard

Architecture guide · Stripe docs checked 18 November 2026

TL;DR

Stripe does not hand you a metrics database. A dashboard can read the API when someone opens it, store webhook events in your own tables, or query Stripe Sigma and Data Pipeline. The durable pattern for MRR and churn you compute yourself is a paginated backfill, a webhook route that verifies Stripe-Signature with stripe.webhooks.constructEvent, an insert keyed on the event id, and a scheduled list that repairs drift.

Data Lighthouse takes the first path. The signed-in revenue route lists active subscriptions and succeeded charges on each request. This repository has no Stripe webhook route and no Stripe event table. The Next.js Stripe analytics dashboard, the SaaS metrics dashboard template, and the live demo are the product pages. The demo uses sample data.

License
$59 once
Refund
7-day no-questions refund
Stack
Next.js 16, shadcn/ui, Recharts, Postgres, Drizzle, Clerk, optional Stripe

On this page

What you are deciding

This page is the data path into a SaaS metrics dashboard: how subscription and charge state gets from Stripe into a screen you control. It is the architecture choice. The arithmetic that turns a subscription into monthly recurring revenue is the guide to calculating MRR from the Stripe API. Customer churn, gross MRR churn, and net MRR churn need two snapshots of that book, which is how to calculate churn rate from Stripe. Net revenue retention and gross revenue retention on that same starting book are how to calculate net revenue retention from Stripe. A single CSV of one export is the Stripe MRR CSV calculator. Whether to build the dashboard, rent a hosted one, or start from a template is build vs buy a SaaS metrics dashboard.

Five ways cover the real options. You can call the Stripe API when the dashboard renders, and follow pagination until the list ends. You can receive webhooks and upsert rows in your database. You can do both, then reconcile on a schedule. You can leave the extract to Stripe Sigma or Data Pipeline. You can connect a hosted metrics product and read their numbers. Each one has a different freshness, a different failure mode, and a different bill. None of them returns an MRR field.

Freshness and correctness pull apart. A webhook can arrive within seconds and still be the wrong row if you apply it twice, apply it out of order, or treat a prorated invoice as the new monthly price. A list call is current when it finishes, and it is incomplete when pagination stops early or a 429 cuts the loop short. Sigma and Data Pipeline are built for analysis volume, and Stripe documents a lag of hours for the common tables.

On-demand API reads and polling

An on-demand read calls subscriptions.list and, if the card is cash collected, charges.list while the request is in flight. Polling is the same call on a timer, writing the result somewhere so the next page view does not wait on Stripe. Both are pull. Stripe does not push.

List endpoints page. The customers search reference states the general limit: it can range from 1 to 100, and the default is 10. Stopping after the first page silently drops the rest of the book. stripe-node auto-pagination follows has_more for you. The async iterator is the current pattern in the stripe-node README:

for await (const subscription of stripe.subscriptions.list({ limit: 100 })).autoPagingToArray({ limit }) collects pages into one array and stops at the limit you pass, which is there so a huge list does not exhaust memory. A cap that fires is a partial book. Treat it as a failed sync, and keep the previous good snapshot.

subscriptions.list takes one status at a time. Omitting it returns subscriptions that have not been canceled. status: "all" also returns incomplete subscriptions. A current MRR card usually lists active. A churn book also lists canceled. The MRR guide walks through which statuses the formula counts.

Rate limits are why this path gets expensive as the dashboard gets popular. Stripe's rate-limit page, read on 18 November 2026, says the global limit is 100 requests per second in live mode and 25 in a sandbox, and that an individual endpoint is 25 requests per second unless a stricter limit is listed. The default global concurrency limit for standard live traffic is 50 in-progress requests. List calls and expanded responses use more of that concurrency. A 429 comes with Stripe-Rate-Limited-Reason: global-rate, endpoint-rate, global-concurrency, endpoint-concurrency, or resource-specific.

There is a separate read allocation. Over a rolling 30 days, read requests must stay at or under an average of 500 per transaction, with a floor of 10,000 reads a month. Writes are outside that allocation. Data products, reporting, and tax calls are excluded. A dashboard that paginates every subscription on every view spends the allocation on page views, which is why Stripe points heavy analytics at Sigma or Data Pipeline. The list is current API state when it finishes, and it disappears when the request ends unless you stored it. Churn needs an earlier book. A live list does not have one.

Webhooks into your database

A webhook endpoint is a public HTTPS URL. Stripe POSTs a JSON event when something in the account changes. You can register up to 16 event destinations. Live mode requires HTTPS and TLS 1.2 or higher. Redirects count as failures. The handler has to read the raw body, because the signature covers those exact bytes.

Stripe signs each delivery in the Stripe-Signature header. The official check is stripe.webhooks.constructEvent(payload, signature, secret). The stripe-node README says the payload must be the raw body. A parsed object, or a string you rebuilt with JSON.stringify, fails verification. The libraries default to a five-minute tolerance between the signed timestamp and your clock. A tolerance of 0 turns that recency check off. Each retry gets a new signature and a new timestamp. Test and live endpoints have different secrets, and so does each destination.

Delivery is at-least-once and unordered. In live mode Stripe retries for up to three days with exponential backoff. A sandbox destination is retried three times over a few hours. The Dashboard can resend an event for 15 days, and the CLI stripe events resend works for 30 days. A manual resend does not cancel the automatic retry schedule. Two deliveries can share an event id, and Stripe also warns that two different Event objects can describe the same change. Log the event id, and when that is not enough, dedupe on the object id plus event.type.

Order is the part teams skip. Creating a subscription can emit customer.subscription.created, invoice.created, invoice.paid, and charge.created. They may arrive in another sequence. Snapshot events record created in seconds, so two events can share a timestamp. Stripe says not to use created as an order key or as proof you have already handled the event. If invoice.paid arrives first, retrieve the subscription, the invoice, and the charge from the API.

Return a 2xx quickly. A slow handler is a timeout, and a timeout is a retry. The work that must finish before that response is the durable write of the event id. If you respond 200 and then crash before the insert, Stripe will not retry, and the change is gone. The MRR rollup can run after the insert, on a queue. Listen only to the types you apply. A metrics mirror usually wants customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, customer.deleted, and the invoice or charge types you use for cash.

Stripe's webhook guide distinguishes snapshot and thin payloads. A snapshot includes data.object. Use one when you need that object, or previous_attributes, without another retrieve. The route below verifies a snapshot body with constructEvent on the Node.js runtime. stripe-node also documents constructEventAsync where the sync verifier is the wrong tool. List events goes back up to 30 days, and retrieve-event is available for 30 days. Events keep the API version from when they were created. A webhook-only database starts the day the endpoint went live, unless you backfill from the subscription and invoice lists.

Backfill, webhooks, and reconciliation

The hybrid path is the one that survives the failure modes above. First, page through the subscriptions you care about and upsert each row. That is the opening book. Second, turn on the webhook and apply events idempotently from that moment. Third, on a schedule, list the same statuses again and replace the stored rows with the API result. The scheduled list is the reconciliation. It repairs a dropped delivery, a deploy that returned 500 for an hour, and an out-of-order snapshot that overwrote a newer row.

Run the delete pass only after the list completes. If you mark every stored subscription canceled when it was missing from a partial page, a rate limit wipes the book. The same rule applies to autoPagingToArray: when the array hits the cap, you do not know whether Stripe had more rows. Keep the previous reconciliation timestamp and try again.

Store subscriptions as rows keyed by subscription id. Store the fact that you handled an event, keyed by event id. Do not add a delta to an MRR counter inside the webhook. A retried customer.subscription.updated would add the same dollars twice. Upserting the subscription, then computing MRR from the table, makes the retry a no-op. Churn still needs you to keep the book as it was at the start of the period. The reconciliation gives you today. A nightly snapshot of that table gives you the comparison. The churn guide is the arithmetic on those two copies.

Idempotency keys on your own API writes are a different mechanism. Stripe uses them so a retried POST you send does not create two customers. Webhook dedupe is the event id on the POST Stripe sends you. Mixing the two up leaves retries inserting a second metrics row.

Sigma and Data Pipeline

Sigma is SQL in the Stripe Dashboard over your transactional data: payments, subscriptions, customers, payouts, and related tables. You can export CSV and schedule a query. Stripe's freshness page says most transaction data is available within three hours, and that API activity is queryable about three hours after it occurs. The same page says Sigma can also see some report data that the API does not expose. Billing tables used for a subscription report, including subscriptions and subscription_items, are listed at three hours.

Data Pipeline syncs Stripe data without you writing the extract. The overview read on 18 November 2026 names Postgres, and the warehouse page names Snowflake, Amazon Redshift, Databricks, and BigQuery. Cloud storage destinations are Amazon S3, Google Cloud Storage, and Azure Blob Storage, as Parquet files. After you accept a warehouse share, core data is available within 12 hours. After the initial load, warehouse and cloud-storage destinations deliver a full load every three hours. Stripe also documents a separate real-time sync to Postgres, including a path that can provision Supabase or Neon. This page does not quote a latency for that sync, because the freshness figures above are the ones stated for Sigma and for the warehouse load.

These are Stripe data products you enable. The Sigma, Data Pipeline, and data-overview pages checked on 18 November 2026 do not publish a price, so this guide does not invent one. Data Pipeline is not offered to customers in India, which the warehouse page attributes to data localization. Sandbox activity is not billed against a Data Pipeline trial, and test-mode rows live in a separate schema.

Use Sigma or Data Pipeline when the question is a finance extract, a join against your own orders table, or a volume the read allocation will not carry. A three-hour lag is a poor fit for a card that should match the API at the moment someone opens the dashboard. Webhooks still win that card. The warehouse wins the historical query. Many teams run both and stop using the webhook tables as a warehouse.

Baremetrics, ChartMogul, and tools like them

Hosted metrics products connect to Stripe, pull or receive the billing data, and compute MRR, churn, and the movement bridge in their own definitions. You get a login and their history. You do not get the ledger. Baremetrics and ChartMogul are the two names people search. ProfitWell Metrics sits in the same category. Their plans, caps, and which movements they name are written up on the Baremetrics and ChartMogul alternatives page, with prices dated 17 November 2026. This page does not restate that price table.

Pick a hosted tool when the bridge (new, expansion, contraction, churn, reactivation) has to exist this week, or when Stripe is not the only billing system. The cost is their subscription and their rules. If your board already quotes a number from ChartMogul, a home-built upsert will not match it until you copy their rules on purpose. The build-versus-buy guide is that choice, including the hour ranges labeled as estimates.

Decision table

Read across a row. Freshness is when a successful run reflects a Stripe change. Cost is the extra product you pay for, and the Stripe docs cited here do not list a Sigma or Data Pipeline price. Correctness is about MRR and churn you compute from the rows, which still depends on the status and coupon rules in the MRR guide.

OptionFreshnessComplexityCostRate limitsMRR and churn
On-demand API readsCurrent when the request finishesA paginated list in the dashboard routeNo separate Stripe data productEvery view spends read requests and list concurrencyCurrent MRR if the list finishes. No stored history, so no churn rate.
Webhooks into your databaseSeconds after Stripe accepts the change, once delivery succeedsSignature check, event ledger, subscription upsertYour database and a public HTTPS routeStripe pushes. You still call the API to backfill and to repair gaps.Correct only if every event is applied once and a missed event is repaired.
Backfill, webhooks, and reconciliationLive events, plus a scheduled list that overwrites driftThe webhook path plus a job that can finish a full listYour database, the route, and a schedulerThe reconcile job is the expensive read. Dashboard views read your database.The usual way to keep MRR and a churn snapshot in your own tables.
Sigma or Data PipelineSigma: about three hours. Warehouse and storage loads: every three hours.SQL in the Dashboard, or a warehouse you already runSeparate Stripe data products. These docs do not publish a price.Excluded from the read-request allocation. Built for analytics volume.Strong for finance extracts. A three-hour lag is a poor live MRR card.
Baremetrics or ChartMogulTheir sync, on their scheduleConnect Stripe. Their definitions, their login.Their plan. Dated prices are on the alternatives page.Their integration spends the API calls.They keep the MRR bridge. You do not own the ledger.

Which stage you are in

The stages below are planning buckets for an indie Stripe product. They are not Stripe plan limits. The $10k line is a common point where a current list still fits in one request and a churn history starts to matter. ChartMogul's free plan, as recorded on the alternatives page, was capped at $10k MRR on 17 November 2026. That is their packaging, not a reason the API changes.

StageWhat to runWhy
Pre-revenueA CSV export or one paginated listThere is no history to protect. A webhook route and an event table are empty machinery.
Under $10k MRROn-demand reads for a current card, or a hosted tool if you need churn this weekA full list still fits in a request. Churn needs a snapshot you store. A free hosted plan may cover that.
ScalingHybrid sync, or Data Pipeline into a warehouseDashboard views should read your database. Listing every subscription on each view spends the read allocation.

Pre-revenue, export a subscriptions CSV or run one list. The CSV calculatornormalizes an export in the browser and does not upload it. Under $10k MRR, that same list is still a reasonable current card when pagination finishes and few people open the page. Publishing churn means keeping yesterday's rows, either with the hybrid path or a hosted product that already stored them. Once the overview is opened all day, dashboard reads should hit your database and a worker should own the backfill, the webhook apply, and the nightly reconciliation. Data Pipeline can replace that extract when finance already has a warehouse. It does not replace the definition of MRR.

Next.js webhook route

App Router route handlers can read the raw body with request.text(). Do that before any JSON parse. The Pages Router flag bodyParser: false is not the App Router switch. The secret in the environment is the endpoint signing secret, whsec_, which is different from STRIPE_SECRET_KEY. getDb() in this repository returns the Drizzle client, or null when Postgres is unset. The helpers it calls are the next snippet. They are examples to add. They are not files in the template, and the template does not mount this route.

app/api/stripe/webhook/route.ts (example)
import { NextResponse } from "next/server"
import Stripe from "stripe"
import { getDb } from "@/lib/db/client"

export const runtime = "nodejs"

// recordStripeEvent and upsertSubscriptionFromEvent are the example in the next block.
// This repository does not ship those functions or a Stripe webhook route.

export async function POST(request: Request) {
  const secretKey = process.env.STRIPE_SECRET_KEY
  const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET
  const db = getDb()
  if (!secretKey || !webhookSecret || !db) {
    return NextResponse.json({ error: "Stripe webhook is not configured" }, { status: 500 })
  }

  const stripe = new Stripe(secretKey)
  const payload = await request.text()
  const signature = request.headers.get("stripe-signature")
  if (!signature) {
    return NextResponse.json({ error: "Missing Stripe-Signature" }, { status: 400 })
  }

  let event: Stripe.Event
  try {
    event = stripe.webhooks.constructEvent(payload, signature, webhookSecret)
  } catch {
    return NextResponse.json({ error: "Invalid signature" }, { status: 400 })
  }

  const outcome = await recordStripeEvent(db, event)
  if (outcome === "duplicate") {
    return NextResponse.json({ received: true, duplicate: true })
  }

  await upsertSubscriptionFromEvent(db, event)
  return NextResponse.json({ received: true })
}

A bad signature is a 400. A missing database is a 500 so Stripe retries after you fix the outage. A duplicate event id is a 200, because the first delivery already landed and another 500 would keep the retry schedule going. Local testing uses stripe listen --forward-to, which prints a signing secret for that session. That secret is not the live endpoint secret.

Idempotent upsert keyed on the event id

The event row uses the Stripe event id as the primary key. onConflictDoNothing makes a retry return no inserted row, which the route treats as a duplicate. The subscription row uses the subscription id. A second delivery updates the same row. It does not insert another one, and it does not add to a running total.

That subscription update is still last-write-wins. Because events are unordered, an older snapshot can arrive after a newer one and put a stale status back. Do not treat event.createdas a version. The reconciliation list in the next section overwrites the table with the API's current subscriptions after a complete pagination. Until that job has run, the webhook table is a best effort.

lib/stripe/sync.ts (example)
import type Stripe from "stripe"
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js"
import { pgTable, text, integer } from "drizzle-orm/pg-core"

export const stripeEvents = pgTable("stripe_events", {
  id: text("id").primaryKey(),
  type: text("type").notNull(),
  created: integer("created").notNull(),
  objectId: text("object_id"),
})

export const stripeSubscriptions = pgTable("stripe_subscriptions", {
  id: text("id").primaryKey(),
  status: text("status").notNull(),
  customerId: text("customer_id"),
})

type Db = PostgresJsDatabase

export async function recordStripeEvent(db: Db, event: Stripe.Event) {
  const objectId =
    event.data.object && "id" in event.data.object ? String(event.data.object.id) : null
  const inserted = await db
    .insert(stripeEvents)
    .values({ id: event.id, type: event.type, created: event.created, objectId })
    .onConflictDoNothing({ target: stripeEvents.id })
    .returning({ id: stripeEvents.id })
  return inserted.length === 0 ? "duplicate" : "new"
}

export async function upsertSubscriptionFromEvent(db: Db, event: Stripe.Event) {
  const subscription = event.data.object
  if (!subscription || subscription.object !== "subscription") return
  const customerId = typeof subscription.customer === "string" ? subscription.customer : subscription.customer.id
  await db
    .insert(stripeSubscriptions)
    .values({ id: subscription.id, status: subscription.status, customerId })
    .onConflictDoUpdate({
      target: stripeSubscriptions.id,
      set: { status: subscription.status, customerId },
    })
}

Backfill loop using auto-pagination

The backfill lists each status separately with limit: 100 and walks the async iterator. That is stripe-node auto-pagination: the SDK requests the next page while has_more is true. saveSubscription is your upsert by subscription id, the same write the webhook uses, fed by the API object instead of event.data.object. Include canceled when the table has to explain who left. Leave it out when the table is only the current active book.

backfillSubscriptions (example)
import Stripe from "stripe"

const SUBSCRIPTION_STATUSES = [
  "active",
  "trialing",
  "past_due",
  "paused",
  "unpaid",
  "canceled",
] as const

export async function backfillSubscriptions(stripe: Stripe) {
  for (const status of SUBSCRIPTION_STATUSES) {
    for await (const subscription of stripe.subscriptions.list({ status, limit: 100 })) {
      await saveSubscription(subscription)
    }
  }
}

The same iterator works for a reconciliation job. Collect the ids only after every status finishes. Then delete or tombstone stored rows in those statuses that the API no longer returned. A thrown 429 aborts the job before that pass. stripe-node retries some network failures and lock timeouts on its own. Rate-limit responses still need backoff with jitter, which Stripe describes on the rate-limit page. Space the status lists. Six tight loops of expanded subscription pages are a concurrency incident, not a backfill.

Data Lighthouse's revenue route uses the other auto-pagination helper, autoPagingToArray, with a cap of 100,000, and it does not write the pages to Postgres. That code is described in the template section. It is a read, not this backfill.

Pitfalls that move the metric

Proration. Stripe prorates when a subscription changes mid-period. The prorated invoice line is the charge or credit for the unused or remaining time. It is cash for that invoice. The new MRR is the subscription items after the change, normalized to a month. If the webhook adds invoice.paid into the MRR column, an upgrade looks like a spike and the following month looks like churn. Keep invoice totals in a cash series. Recompute MRR from items. The proration guide is linked in the sources.

Refunds. charge.refunded and refund.created change cash collected. amount_refunded on the charge is the minor-unit amount already refunded. A refund does not cancel a subscription by itself. Leaving the subscription active and also subtracting the refund from MRR understates the run-rate. Subtracting it from a cash card is a product choice. The Data Lighthouse revenue sum does not subtract it.

Trials. status: "trialing" is a subscription that has not started its first paid period. Counting it as MRR reports revenue the customer has not begun to pay. When the trial ends, Stripe sends customer.subscription.updated and the status becomes active if payment succeeds. A webhook handler that inserts on created and never applies updated leaves the trial row in place. The MRR guide's default is to leave trialing out. Match that rule in the sync or the two pages will disagree.

Currency. unit_amount and charge amountare in the currency's minor unit. Zero-decimal currencies are not divided by 100. A second currency is a second total. Converting with a rate you did not record makes yesterday's MRR move when the rate moves. Store the currency on the row and sum inside one currency. The template locks the first priced currency and skips later items in another currency, and it logs that skip.

Deleted customers. The delete-customer call permanently deletes the customer and immediately cancels any active subscriptions. A deleted customer can still be retrieved, with deleted: true, so history has an id to point at. Card details are removed, and you cannot add a new subscription to that customer. If your table ignores customer.deleted and also misses customer.subscription.deleted, the active book keeps a customer Stripe has already canceled. Tombstone the customer and let the subscription events, or the next reconciliation, drop those subscriptions from the active set.

Out-of-order events. Apply customer.subscription.deleted even when the created event has not arrived. Insert a canceled row rather than waiting. An older updated snapshot can land later and resurrect that row, which is why the reconciliation list exists and why event.created is only a timestamp. cancel_at_period_end leaves the subscription active until the period ends. Treating the flag as an immediate cancellation puts churn in the wrong month. The MRR and churn guides cover that flag in the formula.

What Data Lighthouse actually does

The template's Stripe path is an on-demand read. GET /api/datalighthouse/revenue requires a signed-in Clerk user and STRIPE_SECRET_KEY. The client is constructed with API version 2025-10-29.clover. On each request it loads three Stripe lists in parallel with visitor and conversion queries from Postgres: active subscriptions, succeeded charges for the selected window, and succeeded charges for the previous window of the same length.

loadActiveSubscriptions calls subscriptions.list with status: "active", limit: 100, and an expand for discounts. It follows autoPagingToArray up to 100,000 records and warns if that cap is hit. Subscription items are listed the same way when the first page is incomplete. Coupons that arrive as ids are retrieved and cached. MRR is calculateMrrFromSubscriptions on that list. ARR is that MRR multiplied by 12. Trialing subscriptions are absent because the status filter is active. A second currency is skipped and logged. Metered prices without a unit amount are skipped inside the normalizer.

Cash on the overview is sumSucceededCharges. The function adds charges whose status is succeeded and does not subtract amount_refunded. Postgres on this route is the visitor window and the conversion metrics. Stripe subscriptions and Stripe events are not written there. There is no reconciliation job. Searching this repository finds no stripe.webhooks.constructEvent call and no Stripe webhook route. The Polar webhook at /api/polar/webhook fulfills the template purchase. It is not a Stripe metrics sync.

That is a deliberate fit for a current MRR card beside traffic, and a poor fit if you need churn, a movement bridge, or a record of last quarter's book. The overview does not compute churn, ARPU, or LTV. The live demo renders the same overview with sample data and does not call Stripe. Hosting, Postgres, and Clerk are a separate bill from the $59 license.

If you buy the template and later need history, the revenue route is the piece you replace with the hybrid path on this page. The MRR normalizer can stay. The list that feeds it moves from the request to the reconciliation job. The build vs buy guide prices that extra work as an estimate, and it says the shipped overview does not include churn or cohort cards.

7-day no-questions refund. If the template is not a fit, request it within 7 days through the purchase contact on the contact page.

Sources

Stripe's docs for webhooks, pagination, rate limits, Sigma, and Data Pipeline, read on 18 November 2026. The stripe-node README is the source for constructEvent and the auto-pagination iterators. Product behavior in the template section was checked against this repository.

Stripe sync questions

Short answers on polling, webhooks, Sigma, and the template.

Should I use Stripe webhooks or API polling for SaaS metrics?

Poll with a paginated subscriptions list when the dashboard only needs the current book and the list finishes inside one request. Use webhooks when you need each change stored in your database. Stripe delivers live-mode webhooks for up to three days with exponential backoff, can deliver the same event twice, and does not guarantee order. A durable metrics book is a backfill, webhooks keyed on the event id, and a periodic list that repairs anything the webhook missed.

How do I sync Stripe data to my own database for a dashboard?

Backfill subscriptions with stripe-node auto-pagination, verify each webhook with stripe.webhooks.constructEvent on the raw body, insert the event id so a retry is a no-op, and upsert the subscription row by subscription id. Re-list subscriptions on a schedule and treat that list as the source of truth. The Events API only goes back 30 days, so it cannot rebuild an older book by itself.

How do Stripe Sigma, Data Pipeline, and webhooks differ?

Webhooks push account events to your HTTPS route. Sigma is SQL over Stripe data in the Dashboard, and most transaction tables are queryable within about three hours. Data Pipeline syncs Stripe data to Postgres, Snowflake, Redshift, Databricks, BigQuery, or cloud storage, with a full warehouse or storage load every three hours after the initial share. The documentation pages cited here do not publish a price for Sigma or Data Pipeline.

How do I verify a Stripe webhook in a Next.js route handler?

Read the body with request.text(), pass that string, the Stripe-Signature header, and the endpoint secret to stripe.webhooks.constructEvent, and run the route on the Node.js runtime. Parsing JSON first changes the bytes and the signature check fails. Return 2xx after the event id is stored. Stripe signs a new timestamp on each retry, and the library's default tolerance is five minutes.

Why do prorations, refunds, trials, and currencies break a synced MRR number?

A proration is an invoice adjustment for part of a period. A refund changes a charge. Neither one is the monthly run-rate. MRR comes from the subscription items you decided to count. Trials stay out until the subscription is active. Amounts are minor units, and a second currency is a second total. Deleted customers are still retrievable with deleted set to true, and deleting a customer immediately cancels active subscriptions.

Does the Data Lighthouse template sync Stripe with webhooks?

No. The signed-in revenue route lists active subscriptions and succeeded charges from the Stripe API on each request. It does not store Stripe events, and this repository has no Stripe webhook route. Trialing subscriptions are left out. Refunds are not subtracted from the revenue sum. Churn is not computed. The license is $59 once. The buyer page is https://datalighthouse.dev/nextjs-stripe-analytics-dashboard, the SaaS metrics page is https://datalighthouse.dev/saas-metrics-dashboard-template, and the sample dashboard is https://datalighthouse.dev/demo. The demo uses sample data and does not call Stripe.