Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
Unique discount coupons are a classic referral incentive β and when you combine GrowSurf's referral tracking with Stripe's coupon and promotion code system, you can automatically generate and distribute personalized discount codes to both referrers and their friends. This dual-sided incentive is proven to increase referral conversion rates.
In this guide, you'll learn how to programmatically create Stripe promotion codes tied to GrowSurf referral campaigns. We'll cover generating unique codes for each referrer, applying friend-side discounts at checkout, and tracking which coupons drive the most conversions. Whether you're offering "Give $10, Get $10" or percentage-based discounts, this integration handles it all.
Plan your referral coupon structure. The most effective programs offer rewards to both the referrer and the referred friend (double-sided rewards).
Create a base coupon in Stripe that your promotion codes will be generated from. The base coupon defines the discount amount and restrictions.
max_redemptions if you want to limit total usageWhen a new participant joins your GrowSurf campaign, automatically generate a unique Stripe promotion code linked to the base coupon.
PARTICIPANT_CREATED webhook eventstripe.promotionCodes.create() with a unique code stringConfigure GrowSurf to display the unique Stripe promo code alongside the referral link so participants can share it via social media, email, or word of mouth.
Integrate the promotion code acceptance into your Stripe Checkout or payment flow. When a referred friend uses the code, Stripe applies the discount and you can track the conversion.
allow_promotion_codes: true in your Checkout Session creationMonitor which referral coupons are being redeemed and attribute conversions back to the correct referrer in GrowSurf.
customer.discount.created webhook event// Generate unique promo code when participant joins
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
app.post('/api/growsurf-participant-created', async (req, res) => {
const { participant } = req.body;
// Create a unique promotion code from the base coupon
const promoCode = await stripe.promotionCodes.create({
coupon: 'referral-friend-15pct', // Your base coupon ID
code: `REF-${participant.referralCode.toUpperCase()}`,
max_redemptions: 1, // Single use per friend
metadata: {
growsurf_participant_id: participant.id,
referrer_email: participant.email
}
});
// Update GrowSurf participant with the promo code
await fetch(
`https://api.growsurf.com/v2/campaign/${CAMPAIGN_ID}/participant/${participant.id}`,
{
method: 'PUT',
headers: {
'Authorization': `Bearer ${GROWSURF_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
metadata: { stripePromoCode: promoCode.code }
})
}
);
res.json({ promoCode: promoCode.code });
});
// Stripe Checkout with promo code support
app.post('/api/create-checkout', async (req, res) => {
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
allow_promotion_codes: true, // Enables promo code field
line_items: [{ price: 'price_xxx', quantity: 1 }],
success_url: 'https://yourapp.com/success',
cancel_url: 'https://yourapp.com/cancel'
});
res.json({ url: session.url });
});Instead of random strings, use the referrer's name or username as part of the promo code (e.g., "FRIEND-JOHN20"). Memorable codes get shared more often via word of mouth and are easier to type at checkout.
Pass the promo code as a URL parameter in the referral link (e.g., ?promo=REF-ABC123) and automatically populate it in your checkout flow. This removes friction and increases conversion rates significantly.
Give promo codes a 30-60 day expiration window. Too short and referred friends won't have time to convert; too long and the urgency to act disappears. You can set this via expires_at in the Stripe Promotion Codes API.
Coupons define the discount (e.g., 15% off). Promotion Codes are customer-facing codes linked to a coupon that users enter at checkout. You create one base coupon, then generate many unique promotion codes from it β one per referrer.
Yes. Set max_redemptions: 1 when creating the promotion code. You can also set restrictions.first_time_order: true to ensure it's only used by new customers, preventing existing customers from using referral codes.
Instead of a percentage or amount coupon, create a coupon with duration: 'once' and apply it alongside a trial period extension. Alternatively, use GrowSurf's webhook to call stripe.subscriptions.update() with an extended trial_end timestamp.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
