RoadwayDocs

Choose a revenue model

Roadway supports two revenue models.

The one you choose decides which metrics exist in your workspace.

Revenue models

Model Best for You provide Metrics
Recurring (subscriptions) SaaS and memberships billed on a schedule Stripe tables through Airbyte, or dim__customers and fact__customer_arr_snapshot ARR, new, expansion, contraction, churn, and reactivation ARR; net revenue retention; churn and retention rates; average revenue per customer; customer counts
Transactional E-commerce, marketplaces, usage-based or one-off purchases, in-app purchases fact__transactions and, optionally, dim__customers Revenue, transactions, average order value, new customers, average revenue per customer

A workspace can use both. Every metric can be broken down by attribution (traffic source, channel, campaign, landing page) and by your custom dimensions.

The identity requirement

Roadway attributes each customer to the acquisition touchpoints of the user who paid. So each customer or transaction needs a user_id that matches your Users table.

  • Revenue with no matching user can't be attributed to a channel. Roadway reports it under No tracked visit.
  • If your product has no users, talk to Roadway. This needs custom modeling.

Choose your guide

Situation Guide
Stripe, using Roadway's direct connector Connect Stripe
Stripe, and you need user_id on Stripe objects Pass userID to Stripe
Stripe Payment Links, no logged-in users Stripe Payment Links with GA4 (custom modeling, contact Roadway first)
Stripe data in a warehouse via Airbyte Stripe through Airbyte
Custom subscription model Custom recurring revenue
One-off purchases Transactional revenue
Schema details Revenue and CRM tables

Custom recurring revenue

Use custom tables if you already model revenue metrics such as MRR, or if you bill outside Stripe.

You provide two tables: dim__customers and fact__customer_arr_snapshot. The full column lists are in Revenue and CRM tables.

You need:

  • A warehouse Roadway can read. See Warehouse access.
  • A subscription source of truth, including start dates, plan, billing period, status, and amounts
  • A user_id for each customer that matches your Users table

Steps

  1. Build dim__customers. One row per customer, with customer_id unique and a non-null user_id that matches Users.

    CREATE OR REPLACE VIEW roadway.dim__customers AS
    SELECT
      c.id                        AS customer_id,
      c.user_id                   AS user_id,
      MIN(p.paid_at)::date        AS first_payment_date,
      c.created_at::date          AS created_date,
      UPPER(c.currency)           AS currency
    FROM billing.customers c
    JOIN billing.payments p ON p.customer_id = c.id AND p.status = 'succeeded'
    GROUP BY c.id, c.user_id, c.created_at, c.currency;
    
  2. Build fact__customer_arr_snapshot. One row per customer, per subscription, per day from first payment to today (or churn). The movement columns (new_arr, churn_arr, expansion_arr, contraction_arr, reactivation_arr) are zero except on the day the event happens.

  3. Create a continuous date series with a date spine, then left join subscription states so no day is missing.

  4. Check the rules. churn_arr and contraction_arr are zero or negative; the other ARR columns are zero or positive. Currency must be a valid three-letter ISO code. Primary key is (customer_id, subscription_id, date_day).

  5. Expose both objects in the schema Roadway reads.

Verify

-- No gaps: each subscription's days should be contiguous
SELECT customer_id, subscription_id,
       MIN(date_day) AS first_day, MAX(date_day) AS last_day,
       COUNT(*) AS rows_present,
       DATEDIFF('day', MIN(date_day), MAX(date_day)) + 1 AS rows_expected
FROM roadway.fact__customer_arr_snapshot
GROUP BY customer_id, subscription_id
HAVING COUNT(*) <> DATEDIFF('day', MIN(date_day), MAX(date_day)) + 1
LIMIT 20;

The query returns subscriptions with missing days. It should return nothing. Adapt DATEDIFF to your warehouse.

Troubleshooting

Problem Cause Fix
ARR looks off on specific days Missing days in the snapshot Fill the date series
Customers unattributed user_id doesn't match Users Fix the join key
Negative arr, new_arr, expansion_arr or reactivation_arr Refund logic leaking into ARR Keep those zero or positive. Only churn_arr and contraction_arr are negative

Transactional revenue

Use the transactional model if your revenue is individual purchases rather than subscriptions.

You provide fact__transactions and, optionally, dim__customers.

Talk to Roadway before you build these tables.

You need:

  • A transactions source: orders, payments, or an invoice table
  • A user_id on each transaction that matches Users
  • A customer_id on each transaction. If the user pays directly, set it to the user_id
  • A single reporting currency, in currency units, not cents

Steps

  1. Build fact__transactions. One row per transaction.

    CREATE OR REPLACE VIEW roadway.fact__transactions AS
    SELECT
      o.id                         AS transaction_id,
      o.created_at                 AS transacted_at,      -- UTC timestamp
      o.user_id                    AS user_id,
      o.total_cents / 100.0        AS revenue,            -- currency units, not cents
      COALESCE(o.billing_account_id, o.user_id) AS customer_id  -- required, not null
    FROM shop.orders o
    WHERE o.total_cents <> 0
    UNION ALL
    SELECT
      'refund_' || r.id, r.created_at, o.user_id, -(r.amount_cents / 100.0), COALESCE(o.billing_account_id, o.user_id)
    FROM shop.refunds r
    JOIN shop.orders o ON o.id = r.order_id;
    
  2. Record refunds and chargebacks as separate rows with negative revenue. Don't update the original transaction.

  3. Skip zero-value rows. Roadway ignores rows with revenue = 0.

  4. (Optional) Provide dim__customers. Provide it when several users pay into one account, or when you want to segment customers. If you don't, Roadway creates one customer per customer_id and uses the first transaction as first_payment_date.

  5. Add custom dimensions such as product, SKU, or transaction type as extra columns.

Verify

-- Transactions whose user isn't in Users. They appear as No tracked visit.
SELECT COUNT(*) AS unmatched, SUM(t.revenue) AS unmatched_revenue
FROM roadway.fact__transactions t
LEFT JOIN roadway.users u ON u.user_id = t.user_id
WHERE u.user_id IS NULL;
-- Transactions with no customer ID (must be zero; customer_id is required)
SELECT COUNT(*) AS transactions_missing_customer_id
FROM roadway.fact__transactions
WHERE customer_id IS NULL;
-- Duplicate transaction IDs
SELECT transaction_id, COUNT(*) FROM roadway.fact__transactions GROUP BY 1 HAVING COUNT(*) > 1;

Troubleshooting

Problem Cause Fix
Revenue exactly 100 times too high (1,000 for three-decimal currencies) Amounts in cents Divide by 100 (or 1,000)
Large share of No tracked visit user_id missing or mismatched See Identity resolution
Rows rejected for a missing customer_id No billing account on the order Fall back to the user_id: COALESCE(billing_account_id, user_id)
Revenue doesn't net out Refunds not recorded as negative rows Add refund rows