How can I make an upfront discount available to a referred friend?
Let's say you want to offer a double-sided reward where the referred friend gets an upfront discount before a purchase is made or a signup happens (e.g., "Get 20% off your first invoice!"). GrowSurf supports the following integrations to implement this workflow:
Stripe
Chargebee
Recurly
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 utilizing
growsurf.validateReferrer()then applying your own coupon code for referred visitors.