← View All Guides
Stripe logo
Integration Guide

How to Track Recurring Revenue from Referrals with Stripe + GrowSurf

Monitor lifetime value and recurring revenue generated by your referral program using Stripe and GrowSurf data.

Understanding the long-term revenue impact of your referral program is essential for optimizing spend and proving ROI. While GrowSurf tracks referral sign-ups and conversions, combining that data with Stripe's subscription revenue gives you the complete picture β€” from initial referral click to monthly recurring revenue (MRR) contribution.

This guide shows you how to build a recurring referral revenue tracking system that connects GrowSurf referral data with Stripe subscription events. You'll learn how to attribute ongoing subscription revenue to the original referrer, calculate referral LTV, and build dashboards that show the true value of your referral program over time.

Integration Steps

Step 1: Tag Referred Customers in Stripe

When a referred user becomes a Stripe customer, add metadata that links them back to their GrowSurf referrer. This is the foundation for all downstream revenue attribution.

  • Listen for GrowSurf's CAMPAIGN_REFERRAL_CONVERTED webhook
  • When creating or updating the Stripe customer, add metadata: referred_by, growsurf_referral_id, referral_date
  • This metadata persists on all future invoices and charges for this customer

Step 2: Set Up Stripe Webhook Listeners for Revenue Events

Configure Stripe webhooks to capture all revenue-related events for referred customers. This lets you attribute each payment back to the original referral.

  • Listen for invoice.paid, invoice.payment_succeeded, and customer.subscription.updated
  • Register your webhook endpoint in Stripe Dashboard > Developers > Webhooks
  • Filter events to only process customers with referral metadata

Step 3: Build a Revenue Attribution Database

Create a database table that logs every payment from referred customers, linked to the original referrer. This becomes your source of truth for referral revenue reporting.

  • Store: referrer ID, referred customer ID, payment amount, payment date, subscription plan, and invoice ID
  • Calculate running totals per referrer and per referral
  • Track MRR contribution from referral-sourced customers

Step 4: Calculate Referral LTV Metrics

Build queries that calculate the lifetime value of referred customers compared to non-referred customers. This data proves the ROI of your referral program.

  • Average revenue per referred customer vs. organic customer
  • Churn rate comparison between referred and non-referred cohorts
  • Time-to-first-payment for referred vs. organic sign-ups
  • Total MRR attributed to the referral program

Step 5: Sync Revenue Data Back to GrowSurf

Update GrowSurf participant records with revenue data so you can see financial impact directly in GrowSurf's dashboard.

  • Use GrowSurf's API to update participant metadata with revenue totals
  • Call PUT /v2/campaign/{id}/participant/{participantId} with revenue metadata
  • This enables filtering and segmenting participants by revenue impact in GrowSurf

Step 6: Build Automated Revenue Reports

Create scheduled reports that summarize referral program revenue performance for stakeholders.

  • Weekly summary: new referral revenue, total referral MRR, top referrers by revenue
  • Monthly deep dive: LTV trends, cohort analysis, ROI calculation
  • Use Stripe's Sigma or export data to your BI tool for visualization

Code Snippets

// Tag referred customers in Stripe with referral metadata
async function tagReferredCustomer(stripeCustomerId, growsurfData) {
  await stripe.customers.update(stripeCustomerId, {
    metadata: {
      referred_by: growsurfData.referredBy,
      growsurf_referral_id: growsurfData.referralId,
      growsurf_campaign_id: growsurfData.campaignId,
      referral_date: new Date().toISOString()
    }
  });
}

// Track recurring revenue from referred customers
app.post('/api/stripe-invoice-webhook', async (req, res) => {
  const event = req.body;

  if (event.type === 'invoice.paid') {
    const invoice = event.data.object;

    // Get customer metadata to check if referred
    const customer = await stripe.customers.retrieve(invoice.customer);

    if (customer.metadata.referred_by) {
      // Log revenue attribution
      await db.referralRevenue.create({
        referrerId: customer.metadata.referred_by,
        customerId: customer.id,
        invoiceId: invoice.id,
        amount: invoice.amount_paid,
        currency: invoice.currency,
        period_start: invoice.period_start,
        period_end: invoice.period_end,
        created_at: new Date()
      });

      // Update GrowSurf with cumulative revenue
      const totalRevenue = await db.referralRevenue.sum('amount', {
        where: { referrerId: customer.metadata.referred_by }
      });

      await fetch(
        `https://api.growsurf.com/v2/campaign/${CAMPAIGN_ID}/participant/${customer.metadata.referred_by}`,
        {
          method: 'PUT',
          headers: {
            'Authorization': `Bearer ${GROWSURF_API_KEY}`,
            'Content-Type': 'application/json'
          },
          body: JSON.stringify({
            metadata: {
              total_referred_revenue: totalRevenue,
              last_revenue_update: new Date().toISOString()
            }
          })
        }
      );
    }
  }
  res.json({ received: true });
});

Tips

Use Cohort Analysis for True ROI

Don't just look at total referral revenue β€” analyze it by monthly cohorts. This reveals trends in referral quality over time and helps you identify whether changes to your program are attracting higher or lower LTV customers.

Set Up Real-Time Revenue Alerts

Create alerts that notify your team when referral revenue hits milestones (e.g., total referral MRR crosses $10K). This keeps stakeholders engaged and helps you catch drops in referral revenue quickly.

Compare Referral CAC to Other Channels

Calculate your referral Customer Acquisition Cost by dividing total rewards paid out by the number of converted referrals. Compare this to your paid advertising CAC to quantify the efficiency of your referral program.

FAQ

How do I attribute revenue to the referrer if the customer was created before the referral?

If a customer existed in Stripe before being referred, you can update their metadata after the referral is tracked in GrowSurf. Future invoices will be attributable. For historical accuracy, note the referral start date in metadata and only count revenue from that date forward.

Can I track revenue across multiple Stripe subscriptions per customer?

Yes. The invoice.paid webhook fires for all subscriptions. Your revenue attribution table will capture each invoice separately, so multiple subscriptions from the same referred customer are all counted toward the referrer's total impact.

How do I handle subscription upgrades or downgrades from referred customers?

Stripe's customer.subscription.updated event includes the old and new plan details. Log these changes in your attribution table to track how referred customers' spending changes over time β€” this gives you accurate MRR attribution even as customers change plans.

Set up your refer a friend program with customer referral and affiliate program software that lowers your acquisition costs, increases customer loyalty, and saves you gobs of time.

Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies