# Revenue

Connect Stripe, Paddle, Lemon Squeezy or Polar and see which channels, sources and pages bring the people who pay.

The Revenue page shows the payments your site takes and where the people who paid came from: the channel, source, campaign and landing page of their visits. Your payment provider sends us each payment and refund as it happens. Revenue comes with Insight and Foresight.

## Connect a provider

Open Revenue on your site and pick your provider under Payment providers. Each one shows the address to paste into the provider, the events to send and where to find the signing secret. Owners and admins connect and disconnect providers. Connect each provider you take payments with. A site can use all four.

### Stripe

1. In Stripe, open **Developers**, then **Webhooks**, and add an endpoint with the address from the Revenue page.
2. Select `checkout.session.completed`, `checkout.session.async_payment_succeeded`, `invoice.paid`, `refund.created` and `refund.updated`.
3. Reveal the endpoint's signing secret, which starts with `whsec_`, and paste it on the Revenue page.

We count Checkout Sessions in payment mode, paid subscription invoices with their renewals, and refunds that succeeded. A subscription Checkout counts once, through its first invoice. Events from test mode mark the endpoint as working and count nothing. A payment you take with a PaymentIntent of your own, outside Checkout and invoices, does not count.

### Paddle

1. In Paddle, open **Events**, then **Notifications**, click **New destination**, and paste the address.
2. Select `transaction.completed`, `adjustment.created` and `adjustment.updated`.
3. Copy the destination's secret key, which starts with `pdl_ntfset_`, and paste it.

We count completed transactions with their renewals, and approved refunds. Chargebacks and credits do not count. Connect the destination of your live account. Paddle's sandbox sends no test flag, so its payments would count as real ones.

### Lemon Squeezy

1. In Lemon Squeezy, open **Settings**, then **Webhooks**, and add a webhook with the address.
2. Make up a signing secret of 6 to 200 characters and type it into the webhook.
3. Select `order_created`, `order_refunded`, `subscription_payment_success` and `subscription_payment_refunded`.
4. Paste the same signing secret on the Revenue page.

We count paid orders, each subscription payment after the first, and refunds. The first payment of a subscription arrives as its order, so it counts once. Test mode orders mark the webhook as working and count nothing.

### Polar

1. In Polar, open **Settings**, then **Webhooks**, and add an endpoint with the address. Pick the **Raw** format.
2. Select `order.paid` and `order.refunded`.
3. Copy the endpoint's secret and paste it.

We count paid orders with their renewals, and refunds. Connect the endpoint of your live organization, since the sandbox sends no test flag either.

## Link payments to visits

To tell where a buyer came from, we need the same user ID on their visits and on their payment.

1. Pass the signed-in person's ID to the script, as [Signed-in users](/docs/tracking/identify) shows.
2. Pass the same ID to your provider with each checkout.

| Provider | Where the user ID goes |
|---|---|
| Stripe | `client_reference_id` on the Checkout Session, or `user_id` in the metadata of the session, the invoice or the subscription. Put it on the subscription too, so renewals carry it. |
| Paddle | `user_id` in the checkout's `customData`. Paddle copies it to every renewal. |
| Lemon Squeezy | `checkout[custom][user_id]` in the checkout link, or `custom.user_id` when you create a checkout through the API. |
| Polar | `user_id` in the checkout's `metadata`, or the customer's external ID. |

We link each payment to the person's visits in the year before it, and store a hash of the user ID with it, never the ID itself. A payment without a user ID, or with one the site never sent, still counts in the totals and shows as not linked to a visit.

Where a payment came from is set when it arrives. A later change, such as a page rule that excludes a page, does not move payments already counted.

## The page

- **Revenue.** What customers paid in the range, tax included and before the provider's fees, with an arrow against the period before. Refunds are not taken off.
- **Payments.** How many payments, renewals included.
- **Paying people.** How many different people paid, counting the payments that carry a user ID.
- **Per visitor.** Revenue divided by the site's visitors in the range.
- **Refunds.** The amount refunded in the range. An arrow up is red.
- **Revenue by day.** Each day's revenue in the site's time zone, with your [annotations](/docs/tracking/annotations) marked.
- **Where paying people came from.** Revenue by channel, source, campaign and landing page, for the payments linked to a visit. **First visit** credits the first visit the buyer made in the year before paying. **Latest visit** credits their last visit before paying.
- **New and returning payers.** People who paid for the first time in the range, against people who had paid before it.
- **Payment providers.** Each provider's address, events and status, with when its last event came or what went wrong.

The range in the header picks 7, 30 or 90 days. The numbers refresh each minute, and a site's first payment shows a few seconds after it arrives. Payments stay for your plan's history: 24 months on Insight and 5 years on Foresight.

## Currencies

Each currency counts on its own, with no exchange rates. The page leads with the currency that brought the most revenue in the range, and a switch above the numbers shows the others.

## What we keep

We check each event's signature against your secret before we read it. Stripe, Paddle and Polar sign the time too, and we refuse an event signed more than 5 minutes away from our clock. The same payment sent twice counts once.

From each payment we keep its ID at the provider, the amount, the currency, the time, whether it renewed a subscription and the hash of your user ID. Names, email addresses, addresses and card details in the event are never stored.

## Moving or deleting the site

Connected providers and the payments already counted move with the site when you [transfer it](/docs/dashboard/transfer), and providers keep sending to the same address. The people who connected a provider still know its signing secret, so after you take over a site, roll the secret in your provider and paste the new one. Deleting the site stops its webhooks at once. Restoring it within the recovery window starts them again, and purging it erases its payments with the rest of its data.

## Read it from the API

`GET https://api.ultanimus.com/v1/sites/{id}/revenue`

`{id}` is the site ID or the site's domain. A key with the `stats:read` permission can read it, on Insight and Foresight. Amounts are in the currency's smallest unit, such as cents.

- `range` (string): `7d`, `30d` or `90d`, counted back from now. The default is `30d`.

```bash
curl "https://api.ultanimus.com/v1/sites/YOUR_SITE_ID/revenue?range=30d" \
  -H "Authorization: Bearer $API_KEY"
```

```json
{
  "status_code": 200,
  "data": {
    "domain": "example.com",
    "range": "30d",
    "from": "2026-10-04T00:00:00Z",
    "to": "2026-11-02T14:05:00Z",
    "currencies": [
      {
        "currency": "USD",
        "revenue": 1284500,
        "revenue_before": 1102300,
        "payments": 412,
        "payments_before": 365,
        "people": 380,
        "people_before": 341,
        "refunded": 19800,
        "refunded_before": 24700,
        "refunds": 9,
        "renewals": 702100,
        "unlinked": 98400,
        "unlinked_payments": 37,
        "unnamed_payments": 26
      }
    ],
    "visitors": 48210,
    "visitors_before": 44930,
    "series": [{ "day": "2026-10-04", "currency": "USD", "revenue": 38900, "payments": 12, "refunded": 0 }],
    "first": {
      "channel": [{ "currency": "USD", "value": "organic-search", "revenue": 441200, "payments": 139, "people": 131 }],
      "source": [],
      "campaign": [],
      "page": []
    },
    "last": { "channel": [], "source": [], "campaign": [], "page": [] },
    "payers": [{ "currency": "USD", "new_people": 168, "new_revenue": 582400, "returning_people": 212, "returning_revenue": 702100 }],
    "last_payment": "2026-11-02T13:58:12Z"
  },
  "message": ""
}
```

`unlinked` is the revenue of payments not linked to a visit, and `unnamed_payments` the payments that came without a user ID. Each list under `first` and `last` holds the 10 values with the most revenue in each currency. An empty `value` means the visit had none, such as a visit without a campaign.
