> For the complete documentation index, see [llms.txt](https://docs.roadwayai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roadwayai.com/data-requirements/warehouse-requirements/revenue.md).

# Revenue

Modeling your company's revenue

## Overview

Revenue data represents the financial transactions and subscription metrics that track your business's financial performance. This data is essential for understanding customer lifetime value, monthly recurring revenue (MRR), annual recurring revenue (ARR), churn analysis, and overall financial health.

Roadway supports two revenue paradigms, and the model you pick decides which revenue metrics exist in your workspace. **Recurring revenue** is built from subscription data (Stripe via Airbyte or your own ARR tables) and powers the MRR/ARR family of metrics. **Transactional revenue** is built from a table of individual transaction data (exposed via tables in your warehouse) and drives transactional revenue metrics. Depending on the pricing model of your business, a workspace can use either or both revenue data-modeling paradigms.

## Revenue Models

| **Model**                 | **Best for**                                                           | **Tables you provide**                                                         | **Metrics**                                                                                                                                                                                                                                                               |
| ------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Recurring (subscriptions) | SaaS and memberships billed on a schedule                              | Stripe tables via Airbyte, or `dim__customers` + `fact__customer_arr_snapshot` | Total ARR, New Customer ARR, Net ARR, Expansion / Contraction / Churn / Reactivation ARR, Net Revenue Retention, customer and revenue churn rate, customer retention, average revenue per customer, total / new / churned / expanded / contracted / reactivated customers |
| Transactional             | E-commerce, marketplaces, usage or one-off purchases, in-app purchases | `fact__transactions` (+ optional `dim__customers`)                             | Revenue, transactions, average order value, new customers, average revenue per customer                                                                                                                                                                                   |

As a note, all of the above metrics can be broken down by attribution (traffic source, channel, campaign, landing page, etc.) and by your custom dimensions, regardless of the revenue model. In both cases, Roadway attributes each customer to the acquisition touchpoints of the user who paid.

## Recurring Revenue (Subscriptions)

Finer details about each integration option for recurring revenue can be found below. As a note, for customers who have existing definitions (and modeling) for revenue metrics (such as MRR, New Customer ARR, etc.), we require using the [Custom Revenue Models option.](#custom-revenue-models)

### Airbyte Stripe Connector

Use this method if you're already using Airbyte for data integration. We officially support the [Airbyte Stripe source connector](https://docs.airbyte.com/integrations/sources/stripe) for extracting Stripe payment and subscription data into your data warehouse to then be consumed in Roadway.

#### Airbyte Stripe Streams

To use Roadway AI's revenue analytics with Airbyte, you must configure your Airbyte Stripe connector to sync the following tables to your data warehouse:

| **Table Name**                | **Description**                                          | **Required**                     |
| ----------------------------- | -------------------------------------------------------- | -------------------------------- |
| `stripe_customers`            | Customer information and metadata                        | Required                         |
| `stripe_subscriptions`        | Subscription lifecycle and billing details               | Required                         |
| `stripe_subscription_items`   | Individual items within subscriptions                    | Required                         |
| `stripe_charges`              | Payment transactions and charge details                  | Required                         |
| `stripe_invoices`             | Invoice records and billing information                  | Required                         |
| `stripe_invoice_line_items`   | Detailed line items for each invoice                     | Required                         |
| `stripe_products`             | Product catalog and definitions                          | Required                         |
| `stripe_prices`               | Pricing information for products                         | Required                         |
| `stripe_plans`                | Legacy subscription plans (if using older Stripe setups) | Required                         |
| `stripe_balance_transactions` | Financial transaction records                            | Required                         |
| `stripe_payment_intents`      | Payment intent tracking                                  | Optional                         |
| `stripe_refunds`              | Refund transaction details                               | Optional                         |
| `stripe_coupons`              | Discount and coupon information                          | Required                         |
| `stripe_checkout_sessions`    | Checkout session data                                    | Conditional Required (see below) |
| `stripe_events`               | Stripe webhook events                                    | Required                         |

**Key Notes**:

* ⚠️ `stripe_checkout_sessions` is conditionally required if you bill via [Stripe Payment Links](https://stripe.com/docs/payment-links)
* The [sync mode](https://docs.airbyte.com/understanding-airbyte/connections#sync-modes) for these tables should include a deduplication method. We recommend `Incremental - Append + Deduped`
* Airbyte allows for table prefixing. We recommend prefixing with `stripe_`

### Custom Revenue Models

Use this method for maximum flexibility or when integrating with existing data infrastructure. This **custom connector option** allows you to implement your own Stripe data extraction and define your own revenue metrics while maintaining compatibility with our revenue analytics models.

#### Custom Revenue Analytics Tables

**`dim__customers`**

Customer dimension table containing customer metadata and segmentation information.

| **Column Name**                 | **Data Type** | **Description**                             | **Required** |
| ------------------------------- | ------------- | ------------------------------------------- | ------------ |
| `customer_id`                   | varchar       | Unique customer identifier (primary key)    | Required     |
| `user_id`                       | varchar       | Internal user identifier                    | Required     |
| `first_payment_date`            | date          | Date of customer's first successful payment | Required     |
| `created_date`                  | date          | Customer account creation date              | Required     |
| `currency`                      | varchar       | Customer's primary currency                 | Required     |
| `<optional_custom_dimension_1>` | varchar       | Custom customer segmentation field          | Optional     |
| ...                             | ...           | ...                                         | ...          |

**Primary Key:** `customer_id`

**Table Constraints:**

* `customer_id` must be unique across all records
* Supports custom customer dimension columns for business-specific segmentation
* Enables flexible customer analysis and cohort tracking

<details>

<summary><strong>DDL Example</strong></summary>

```sql
create table dim__customers (
    customer_id varchar(255) primary key,
    user_id varchar(255),
    first_payment_date date not null,
    created_date date not null,
    currency varchar(3) not null,
    custom_dimension_1 varchar(255),
    custom_dimension_2 varchar(255),
    custom_dimension_3 varchar(255)
);
```

</details>

**`fact__customer_arr_snapshot`**

Daily snapshot of customer Annual Recurring Revenue (ARR) and subscription metrics.

| **Column Name**       | **Data Type** | **Description**                                            | **Required** |
| --------------------- | ------------- | ---------------------------------------------------------- | ------------ |
| `customer_id`         | varchar       | Customer identifier                                        | ✅            |
| `subscription_id`     | varchar       | Subscription identifier                                    | ✅            |
| `date_day`            | date          | Date of the snapshot                                       | ✅            |
| `implied_arr`         | float         | Annualized recurring revenue based on current subscription | ✅            |
| `paid_arr`            | float         | ARR based on actual payments received                      | ✅            |
| `new_arr`             | float         | New ARR from new subscriptions on this date                | ✅            |
| `churn_arr`           | float         | ARR lost from canceled subscriptions                       | ✅            |
| `expansion_arr`       | float         | ARR gained from subscription upgrades/expansions           | ✅            |
| `contraction_arr`     | float         | ARR lost from subscription downgrades/contractions         | ✅            |
| `reactivation_arr`    | float         | ARR gained from reactivated subscriptions                  | ✅            |
| `num_seats`           | integer       | Number of seats/licenses in subscription                   | ⚠️           |
| `plan_type`           | varchar       | Subscription plan identifier                               | ✅            |
| `billing_period`      | varchar       | Billing frequency (monthly, annual, etc.)                  | ✅            |
| `subscription_status` | varchar       | Current subscription status                                | ✅            |

**Primary Key:** `(customer_id, subscription_id, date_day)`

**Table Constraints:**

* Must contain continuous daily records from first payment date to current date (or churn date)
* ARR calculations are automatically computed based on subscription pricing and billing cycles
* Enables comprehensive revenue trend analysis and customer lifecycle tracking
* Supports multi-subscription customers with separate records per subscription

<details>

<summary><strong>DDL Example</strong></summary>

```sql
create table fact__customer_arr_snapshot (
    customer_id varchar(255) not null,
    subscription_id varchar(255) not null,
    date_day date not null,
    implied_arr float not null,
    paid_arr float not null,
    new_arr float not null,
    churn_arr float not null,
    expansion_arr float not null,
    contraction_arr float not null,
    reactivation_arr float not null,
    num_seats integer,
    plan_type varchar(255) not null,
    billing_period varchar(50) not null,
    subscription_status varchar(50) not null,
    primary key (customer_id, subscription_id, date_day),
    foreign key (customer_id) references dim__customers(customer_id)
);
```

</details>

#### Data Validation

* **Unique customer\_id**: Each customer should appear only once in the customers dimension table
* **Non-null customer\_id**: Every customer record must have a unique identifier
* **Non-null subscription\_id**: Every ARR snapshot record must have a subscription identifier
* **Non-null date\_day**: Every ARR snapshot record must have a date
* **Valid timestamps**: All date fields should be valid dates
* **Non-negative ARR values**: All ARR metrics should be >= 0
* **Valid currency codes**: Customer currency should be valid 3-character ISO codes
* **Continuous date series**: ARR snapshots should contain continuous daily records from first payment to current date (or churn date)

#### Data Integrity Expectations

* **Customer consistency**: `customer_id` values should be consistent across all tables
* **Subscription lifecycle**: ARR snapshots should accurately reflect subscription state changes
* **Revenue calculations**: ARR calculations should be based on actual subscription pricing and billing cycles
* **Multi-subscription support**: Customers with multiple subscriptions should have separate ARR records per subscription
* **Data freshness**: Revenue data should be updated regularly to reflect current subscription states

## Transactional Revenue

Use this model if your revenue is made of individual purchases (orders, one-off payments, marketplace transactions) rather than subscriptions, or if you already model transactions in your warehouse. Roadway attributes each transaction to the acquisition touchpoints of the user who paid and builds the transactional metrics listed under [Revenue Models](#revenue-models) directly from this table. Recurring-revenue metrics such as ARR and churn are not computed from transactions; provide the subscription tables above if you need them as well.

{% hint style="info" %}
Transactional revenue support is newer than recurring revenue and has so far been built for a small number of customers. The requirements below may change as we support more businesses, and we will confirm the exact tables we need with you during onboarding.
{% endhint %}

### Transactional Revenue Tables

**`fact__transactions`**

Fact table containing one row per transaction.

| **Column Name**                 | **Data Type** | **Description**                                                                                                                          | **Required** |
| ------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| `transaction_id`                | varchar       | Unique transaction identifier (primary key)                                                                                              | Required     |
| `transacted_at`                 | timestamp     | UTC timestamp of the transaction                                                                                                         | Required     |
| `user_id`                       | varchar       | The paying user. Must match `user_id` in the [Users](https://docs.roadwayai.com/data-requirements/warehouse-requirements/users.md) table | Required     |
| `revenue`                       | decimal       | Transaction amount in your reporting currency. Negative for refunds and chargebacks                                                      | Required     |
| `customer_id`                   | varchar       | Billing account the transaction belongs to, when it differs from the user. Joins `dim__customers`                                        | Optional     |
| `<optional_custom_dimension_1>` | varchar       | Custom transaction attribute to group revenue by (product, SKU, transaction type, etc.)                                                  | Optional     |
| ...                             | ...           | ...                                                                                                                                      | ...          |

**Primary Key:** `transaction_id`

**Table Constraints:**

* `transaction_id` must be unique across all records
* `user_id` is used to join each transaction to its attribution. Transactions whose `user_id` does not match a user in the Users table are reported under "No tracked visit"
* `revenue` must be in currency units (not cents or micros), in a single reporting currency across the table
* Refunds and chargebacks should be added as separate rows with a negative `revenue`, rather than updating the original transaction
* Rows with a `revenue` of 0 are ignored
* Custom dimension columns can be used to filter and group revenue metrics

<details>

<summary><strong>DDL Example</strong></summary>

```sql
create table fact__transactions (
    transaction_id varchar(255) primary key,
    transacted_at timestamp not null,
    user_id varchar(255) not null,
    revenue decimal(18,2) not null,
    customer_id varchar(255),
    custom_dimension_1 varchar(255),
    custom_dimension_2 varchar(255)
);
```

</details>

**`dim__customers` (optional)**

For transactional revenue, this table is optional. When it is not provided, Roadway creates one customer per `user_id` from `fact__transactions`, using the user's first transaction as the `first_payment_date`. We recommend providing it when several users can pay into the same account, or when you want to segment customers by your own attributes.

| **Column Name**                 | **Data Type** | **Description**                                                 | **Required** |
| ------------------------------- | ------------- | --------------------------------------------------------------- | ------------ |
| `customer_id`                   | varchar       | Unique customer identifier (primary key)                        | Required     |
| `user_id`                       | varchar       | The user who created the customer. Must match a Users `user_id` | Required     |
| `first_payment_date`            | date          | Date of the customer's first transaction                        | Required     |
| `created_date`                  | date          | Customer account creation date                                  | Optional     |
| `currency`                      | varchar       | Customer's primary currency                                     | Optional     |
| `<optional_custom_dimension_1>` | varchar       | Custom customer segmentation field                              | Optional     |

#### Data Validation

* **Unique transaction\_id**: Each transaction should appear only once in `fact__transactions`
* **Non-null user\_id, transacted\_at and revenue**: Every transaction must have a user, a timestamp and an amount
* **User ID consistency**: `user_id` values should match those in the Users table. Revenue from unmatched users is reported under "No tracked visit"


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.roadwayai.com/data-requirements/warehouse-requirements/revenue.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
