Integrations · Shops and payments

Stripe, paid checkouts from your webhook.

Paid Stripe checkouts and subscription renewals from your own webhook, joined to the buyer’s visit through the SDK, with amounts converted for every currency.

Through the SDKFrom your webhookCounted once
Events from StripeStripe
  • PurchasePaid checkouts
  • Subscription renewedRenewals

From your Stripe webhook, through the SDK.

Illustration

At a glance

Sales from your webhook, joined to the visit.

What the SDK does with a paid order.

  • A few lines

    One helper turns the webhook into a sale.

  • Joined to the visit

    With the buyer’s address and browser, the sale joins their visit.

  • Counted once

    Each sale carries an id, so a webhook sent again isn’t a second sale.

  • Any other app

    Send a name, revenue, address and browser from anything else.

What is counted

Paid checkouts and renewals.

Add the visit to the Checkout Session, then hand each webhook event to the SDK.

EventWhenDetails
PurchaseA Checkout Session is paidFrom your webhook with fromStripe, joined to the visit through the session’s metadata
Subscription renewedA renewal is paidFrom the same webhook
AmountsEvery eventConverted from Stripe’s cents for each currency, including those with no decimals or three

Where it shows

Where you see it.

Sales sent through the SDK show next to the rest of the stats.

  • Revenue

    Revenue and conversion rate in the key numbers.

  • Goals and events

    Each sale as an event, with revenue.

  • Paths to conversion

    Sources, campaigns and pages that lead to sales.

  • Sources and campaigns

    Revenue per source and per campaign.

  • All sites

    Every website’s revenue together.

  • Reports and portal

    In email reports and the client portal.

In your app

Two lines in your checkout and webhook.

Add stripeMetadata to the Checkout Session inside the buyer’s request. In your Stripe webhook, fromStripe turns paid checkouts and renewals into sales.

  • The sale is credited to the source that brought the buyer
  • fromStripe sets each event’s id for you
  • Works with Next.js, Node.js and any server
Read the SDK guide →
webhook.tsTypeScript
import { stripeMetadata, fromStripe } from 'nahnu-analytics-sdk';

// Creating the Checkout Session, inside the buyer's request
await stripe.checkout.sessions.create({ /* … */ metadata: { ...stripeMetadata(request, website.id) } });

// Your Stripe webhook: paid checkouts → Purchase, renewals → Subscription renewed
const sale = fromStripe(event);
if (sale) await stats.events.send(sale.site ?? website.id, sale.event);

Not tied to a request

Renewals, imports and other apps.

A cron job or an import sends one event or a list. For any other app, send a name, revenue, the buyer’s address and browser: with them the sale joins the visit, without them it still counts.

  • Give every event an id, such as the order number
  • The answer says how many were accepted, rejected and duplicates
  • The SDK can then retry safely
Sales and signups from your server →
cron.tsTypeScript
// A cron job or an import: one event or a list (up to 50).
await stats.events.send(website.id, {
  name: 'Renewal',
  id: invoice.id, // the same id within three days counts once
  revenue: { amount: 49, currency: 'USD' },
});

Questions

Stripe questions

Something else? Ask us.

Is this the Stripe billing for my clients?

No. This counts your own app’s Stripe sales as revenue. Billing clients by card is a separate feature.

Can a webhook sent twice count twice?

No. fromStripe sets each event’s id, so the same sale is counted once.

Which currencies work?

All of them. Amounts are converted from Stripe’s cents for each currency, including those with no decimals or three.

Do I need WordPress?

No. The SDK runs in your own server code, such as Next.js or Node.js.

Try it on every client site.

Unlimited websites, every feature, one license.