Integrations

Payments

Connect Stripe to see revenue in Databuddy, credited to the visit, campaign and user that brought it.

  1. Visitor checks out
  2. Your server adds their IDs
  3. Stripe reports the payment
  4. Revenue shows its source

Connect Stripe

Open Website → Revenue and choose Connect Stripe, then approve read access in Stripe. There's no webhook to create.

New paymentsArrive within seconds
HistoryPayments and refunds from the 12 months before you connected, with progress in Revenue settings. Older payments usually stay unattributed because their visits can't be matched.
SubscriptionsCurrent ones that name an account bring their plan and billing to Accounts right away
WebsitesEach Stripe account and environment connects to one website. Payments whose metadata names another website in your organization appear there.
Test modeA test-mode connection receives test payments; a live one, live payments

If you can't connect, use the manual webhook.

Add browser identity to your payments

checkout.ts
import { getRevenueMetadata } from "@databuddy/sdk";

// Browser: send this visit's IDs with the checkout request
await fetch("/api/checkout", {
  method: "POST",
  body: JSON.stringify({ metadata: getRevenueMetadata() }),
});
api/checkout.ts
// Server: keep only the visit from the browser, and set who paid yourself
const visit = Object.fromEntries(
  Object.entries(body.metadata ?? {}).filter(
    ([key]) => key === "databuddy_session_id" || key === "databuddy_anonymous_id"
  )
);
const metadata = {
  ...visit,
  databuddy_client_id: process.env.DATABUDDY_CLIENT_ID,
  databuddy_profile_id: user.id, // leave out for guest checkout
};
await stripe.paymentIntents.create({ amount, currency, metadata });

A buyer can edit what their browser sends. Passing getRevenueMetadata() through unchanged lets them credit a payment to another user, account or website.

FieldCredits revenue to
databuddy_session_idThe exact visit, with its referrer and campaign
databuddy_anonymous_idThe browser's visitor, while that ID can still be matched
databuddy_profile_idYour identified user, stored as sent
databuddy_group_<type>An account, set on the Subscription from your server, so its plan, billing status and MRR stay current

Databuddy tries the session, then the profile, then the anonymous ID. Each needs a matching browser event on the same website at or before the payment. Session IDs must come from the browser tracker; IDs made on the server, or sent with server-side track(), never match. Prefer session and profile IDs for renewals, since anonymous IDs can stop matching once their privacy salt rotates.

When nothing matches, an earlier verified session for the same Stripe customer can still credit a renewal. Revenue attribution is attributed completed-payment revenue divided by all completed-payment revenue in that currency, with refunds shown separately.

Read recurring revenue

Revenue shows MRR, ARR, ACV and active subscriptions from Stripe with no extra setup. Without Stripe subscriptions, they come from the MRR your accounts send.

RuleEffect
What countsPaid invoices, after discounts and before tax, spread over each line's billing period
Unpaid or fully discountedAdds nothing, so MRR can be lower than Stripe's Billing overview
Canceled mid-periodStops the day it ends with customer.subscription.deleted; without it, at the end of the paid period
Invoiced before billing periods were recordedCounts from its next invoice

MRR movement splits each day's change into new, expansion, contraction and churn. Beside it are net and gross revenue retention, subscription churn and the quick ratio. Biggest changes lists the subscriptions that moved MRR most, each linked to Stripe.

Check it works

Send a Stripe test payment, then open Website → Revenue. If you sent a profile ID, the payment also shows on that user in Website → Users.

ProblemCheck
Nothing appearsThe connection in Revenue settings, the website, currency, date range, and test versus live mode
Not attributedA browser event on the same website before the payment, with a matching ID
A manual flow never attributesYour Stripe endpoint subscribes to every event below; a new payment flow doesn't add events
Stripe shows failed deliveriesThe reply in Stripe. "No signing secret saved" or a signature mismatch means the secret is missing or from another endpoint.

Manual webhook setup

Use this only for a Stripe account you don't connect. Open Website → Revenue, choose Use a webhook instead or Add a webhook, then Add webhook URL. Add that URL as an endpoint in the Stripe dashboard with these events:

EventPurpose
invoice.paidSubscriptions and invoices: links each invoice to its visitor
invoice_payment.paidSubscriptions and invoices: records the amount paid
payment_intent.succeededOne-time payments: records the amount paid

Set the endpoint's API version to 2025-03-31.basil or later, which is the first with invoice_payment.paid. Enable both invoice events for subscriptions: one carries the amount, the other your metadata. invoice.payment_succeeded also works in place of invoice.paid.

Optional eventAdds
checkout.session.completed, checkout.session.async_payment_succeededLinks metadata set only on a Checkout Session, including delayed payment methods
charge.refunded, charge.dispute.closedRefunds, and chargebacks you lose
payment_intent.payment_failed, invoice.payment_failed, payment_intent.canceledFailed and canceled payments
customer.subscription.created, .updated, .deletedAccount billing, and MRR that stops when a subscription ends

Paste the endpoint's signing secret (whsec_…) into Revenue settings. Until then, deliveries are refused; Stripe retries them for up to 3 days, so they're recorded once it's saved.

How is this guide?