How can I make an upfront discount available to a referred friend?
The Upfront Discount feature allows you to offer a discount to referred friends before they make a purchase or sign up (e.g., “Get 20% off your first invoice!”).
This is supported through the following integrations:
- Stripe — Follow the instructions here
- Chargebee — Follow the instructions here
- Recurly — Follow the instructions here
How it works
- In your Campaign Editor, go to 1. Rewards and select Double-sided reward.
- Scroll down and click Continue.
- Click the vertical three dots (⋮) next to the reward and select Edit.
- Add a description for both:
- The referrer
- The referred friend
- Enable the option "Give the referred friend their reward upfront instead of after they complete the qualifying action."
- Click Save.
Connecting your payment provider
- Go to 4. Options > Integrations.
- Select your payment provider (Stripe, Chargebee, or Recurly) and connect your account.
- Click Connect a Reward and link your rewards one by one.
- For your double-sided reward, select "Both the referrer and referred friend."
Important: Remember to save your changes anytime you update your campaign.
Applying the upfront discount
Stripe Payment Links
If you’re using Stripe Payment Links, GrowSurf will automatically append the promotion code to your payment links so the discount is pre-applied at checkout.
Important: Make sure “Allow promotion codes” is enabled in your Stripe settings.
Not using Stripe Payment Links?
If you're not using Stripe Payment Links, you can retrieve the upfront discount using GrowSurf’s JavaScript method growsurf.getUpfrontDiscount() and apply it programmatically in your checkout flow:
const discount = growsurf.getUpfrontDiscount('stripe');
if (discount) {
console.log(discount.promotionCode);
// e.g., "GRSF-A1B2C3D4"
console.log(discount.couponId);
// Stripe coupon ID
// Apply discount.promotionCode in your checkout flow
}
Using Chargebee or Recurly
If you're using Chargebee or Recurly, the upfront discount is applied through the coupon configured in your integration settings.
Unlike Stripe Payment Links, the coupon application for Chargebee and Recurly depends on your checkout configuration.
You can retrieve the upfront discount using GrowSurf’s JavaScript method growsurf.getUpfrontDiscount() and apply it to your checkout flow:
const discount = growsurf.getUpfrontDiscount('<provider>');
if (discount) {
console.log(discount.promotionCode);
// e.g., "grsf-a1b2c3d4"
console.log(discount.couponId);
// Coupon ID in your billing platform
// Apply discount.promotionCode in your checkout flow
}
Not using any of those integrations?
Use our JavaScript method growsurf.validateReferrer() to check if a referral is valid, then apply a coupon. Here is a code example:
function applyCouponCode() {
const isReferralLinkValid = growsurf.validateReferrer();
if (isReferralLinkValid) {
// Apply your custom coupon code here
}
};
// Check to see if GrowSurf is available
if (!window.growsurf) {
// Listen and wait for the Growsurf Universal Code to initialize
window.addEventListener('grsfReady', () => {
console.log('GrowSurf is ready!');
applyCouponCode();
});
} else {
console.log('GrowSurf is already available');
applyCouponCode();
}
Notes:
- Upfront discounts are only available for referral programs (affiliate programs are not supported).
- Upfront discounts cannot be used with dynamic rewards.
- If you still want to apply upfront discounts, we recommend creating a single-sided reward and using growsurf.validateReferrer() to apply your coupon code to referred visitors.