Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
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.
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.
In your Stripe Dashboard, create the coupons that will be applied to referrers' subscriptions. Navigate to Products > Coupons and create a new coupon.
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.
/api/growsurf-webhook)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.
stripe.customers.list({ email: referrerEmail }) to find the customerWith 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.
stripe.subscriptions.update(subscriptionId, { coupon: couponId })discount objectSend 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.
Use GrowSurf's test mode and Stripe's test environment to validate the full referral-to-reward pipeline before going live.
// 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 });
}
}
});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.
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.
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.
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).
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.
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.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
