← View All Guides
Stripe logo
Integration Guide

How to Set Up Subscription Referral Rewards with Stripe + GrowSurf

Automatically reward referrers with subscription discounts when their friends sign up and subscribe through Stripe.

Combining GrowSurf's referral tracking with Stripe's subscription billing unlocks one of the most powerful growth loops for SaaS businesses: subscription referral rewards. When a referred user subscribes through Stripe, GrowSurf can automatically trigger a reward for the referrer β€” whether that's a percentage discount on their next billing cycle, a free month, or account credits.

In this guide, you'll learn how to connect GrowSurf with Stripe to automatically apply subscription discounts or credits to referrers when their referred friends convert to paying subscribers. We'll walk through setting up the webhook pipeline, creating Stripe coupons, and configuring GrowSurf's reward engine to orchestrate the entire flow without manual intervention.

Integration Steps

Step 1: Configure Your GrowSurf Campaign Rewards

In GrowSurf's Campaign Builder, navigate to the Rewards section. Select "Custom Reward" as your reward type. This gives you full control over what happens when a referral converts. Set the reward trigger to "Referral Converted" so the reward fires when a referred participant reaches your conversion goal.

  • Go to Campaign > Rewards in GrowSurf
  • Choose "Custom Reward" under reward type
  • Set trigger to "On Referral Converted"
  • Note the webhook URL that GrowSurf will call

Step 2: Create Stripe Coupons for Referral Rewards

In your Stripe Dashboard, create the coupons that will be applied to referrers' subscriptions. Navigate to Products > Coupons and create a new coupon.

  • Set the coupon type (percentage off or fixed amount)
  • Choose "Once" for duration if giving a one-time discount, or "Repeating" for multiple billing cycles
  • Name it descriptively, e.g., "referral-reward-20pct"
  • Save the coupon ID β€” you'll need it in your webhook handler

Step 3: Set Up a Webhook Endpoint to Receive GrowSurf Events

Create a server endpoint that listens for GrowSurf's webhook events. When a referral is marked as converted, GrowSurf sends a POST request with the referrer and referred participant details.

  • Create a POST endpoint at your server (e.g., /api/growsurf-webhook)
  • Parse the incoming JSON payload for the referrer's email
  • Validate the webhook signature using GrowSurf's shared secret

Step 4: Look Up the Referrer's Stripe Customer

Using the referrer's email from the webhook payload, look up their Stripe Customer object. This is necessary to apply the coupon to their active subscription.

  • Use stripe.customers.list({ email: referrerEmail }) to find the customer
  • Retrieve their active subscription ID
  • Handle edge cases where the customer may not exist in Stripe yet

Step 5: Apply the Coupon to the Referrer's Subscription

With the Stripe customer and subscription identified, apply the coupon you created in Step 2 to their subscription so the discount takes effect on their next billing cycle.

  • Use stripe.subscriptions.update(subscriptionId, { coupon: couponId })
  • Confirm the coupon was applied by checking the subscription's discount object
  • Log the result for auditing purposes

Step 6: Notify the Referrer About Their Reward

Send a notification to the referrer letting them know their discount has been applied. You can use GrowSurf's built-in email notifications or trigger a custom email via your transactional email provider.

  • Configure the success email in GrowSurf under Campaign > Emails > Reward Earned
  • Customize the email template with reward details (e.g., "You've earned 20% off your next month!")
  • Include a CTA encouraging them to refer more friends

Step 7: Test the Complete Flow End-to-End

Use GrowSurf's test mode and Stripe's test environment to validate the full referral-to-reward pipeline before going live.

  • Create a test referral in GrowSurf's dashboard
  • Trigger a conversion event manually
  • Verify the Stripe coupon was applied to the test subscription
  • Check that the notification email was sent

Code Snippets

// Webhook handler for GrowSurf referral conversion
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);

app.post('/api/growsurf-webhook', async (req, res) => {
  const { event, participant, referrer } = req.body;

  if (event === 'CAMPAIGN_REFERRAL_CONVERTED') {
    try {
      // Look up referrer in Stripe by email
      const customers = await stripe.customers.list({
        email: referrer.email,
        limit: 1
      });

      if (customers.data.length > 0) {
        const customer = customers.data[0];
        // Get active subscription
        const subscriptions = await stripe.subscriptions.list({
          customer: customer.id,
          status: 'active',
          limit: 1
        });

        if (subscriptions.data.length > 0) {
          // Apply referral coupon
          await stripe.subscriptions.update(
            subscriptions.data[0].id,
            { coupon: 'referral-reward-20pct' }
          );
          console.log(`Applied referral reward to ${referrer.email}`);
        }
      }
      res.status(200).json({ success: true });
    } catch (error) {
      console.error('Error applying reward:', error);
      res.status(500).json({ error: error.message });
    }
  }
});

Tips

Stack Referral Rewards Carefully

If a referrer earns multiple rewards, decide whether discounts should stack or replace each other. Stripe only allows one coupon per subscription, so consider using Stripe's promotion_codes or applying credits to the customer's balance instead for stackable rewards.

Use Stripe Customer Balance for Flexible Credits

Instead of coupons, consider adding credits to the referrer's Stripe customer balance using stripe.customers.createBalanceTransaction(). This approach lets you stack multiple referral rewards and gives referrers a running credit balance.

Set Up Idempotency to Prevent Double Rewards

GrowSurf webhooks may retry on failure. Use idempotency keys when making Stripe API calls and track which referrals have already been rewarded in your database to avoid applying duplicate discounts.

FAQ

Can I give different rewards for different subscription tiers?

Yes. In your webhook handler, check the referrer's current Stripe subscription plan and apply different coupons based on their tier. You can also use GrowSurf's reward tiers feature to set milestone-based rewards (e.g., 10% off for 1 referral, 25% off for 5 referrals).

What happens if the referrer cancels their subscription before the reward is applied?

Your webhook handler should check for an active subscription before applying the coupon. If no active subscription is found, you can either store the reward for later application or add it as a customer balance credit that applies when they re-subscribe.

Does GrowSurf automatically detect when a referred user subscribes in Stripe?

GrowSurf doesn't natively monitor Stripe events. You need to either use GrowSurf's JavaScript SDK to mark participants as converted when they subscribe, or set up a Stripe webhook that listens for customer.subscription.created events and calls GrowSurf's API to trigger the conversion.

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