# Subscription goals

> Built-in goals for trials, payments, renewals, plan changes, cancellations and refunds, written from your payment provider so funnels and alerts can end at "Paid".

When a payment provider is connected (or you send payments with the [payments API](https://reveata.com/docs/payments-api)), Reveata turns each payment and subscription change into a goal on the visitor it is attributed to. You don't add any code. They appear in **Goals** with readable names, and you can use them like any other goal: as funnel steps, in filters, in segments and in goal alerts.

| Goal | Shown as | When |
|---|---|---|
| `billing:trial_started` | Trial started | A free trial starts |
| `billing:paid` | Paid | A new payment: a one-off purchase, or the first paid invoice of a subscription (also after a trial) |
| `billing:renewed` | Subscription renewed | Each recurring payment after the first |
| `billing:upgraded` | Subscription upgraded | The subscription's monthly value goes up |
| `billing:downgraded` | Subscription downgraded | The subscription's monthly value goes down |
| `billing:cancel_scheduled` | Cancellation scheduled | The customer cancels and the subscription ends at the end of the period |
| `billing:ended` | Subscription ended | The subscription is cancelled or expires |
| `billing:refunded` | Refunded | A refund or chargeback |

Each goal carries properties you can break it down by: `provider`, `payment` (transaction id), `subscription`, `amount` (site currency, minor units) and `currency` for payments, and `mrr_change` and `mrr` for plan changes.

## How they are counted

- **On the right visit.** The goal is placed on the visitor's visit at the time of the payment or change (the latest visit that had started by then), with that visit's source and location.
- **Once.** Each goal is tied to its payment or subscription. Webhook retries, imports, re-attribution and re-syncs rewrite it instead of adding another, so nothing is counted twice. A deleted payment takes its goal with it.
- **Late links count too.** If a payment is linked to a visitor later (the buyer is identified afterwards, or a [thank-you page claim](https://reveata.com/docs/thank-you-page-payments) arrives), its goal appears then. Payments already recorded when this feature arrived are back-filled once.
- **Only attributed payments.** A payment with no visitor has no visit to put a goal on, so it isn't a goal (it still counts as revenue). Unverified browser payments never produce goals.

The `billing:` prefix is reserved. The tracker, the events API and page goals cannot send these names.

## Use them

- **A funnel that ends at Paid:** pricing page → `signup` → `billing:trial_started` → `billing:paid`.
- **Alerts:** a goal alert on `billing:cancel_scheduled` or `billing:ended` tells you about churn as it happens.
- **Filters:** "visits that completed `billing:paid`" shows which sources and pages convert into paying customers.

Plan changes, cancellations and ends come from providers that send subscriptions:

- Stripe
- Polar
- Dodo Payments

The payments API sends payments only, so it produces trial, paid, renewed and refunded goals.
