Webhooks - adding benefits to referrals
Webhooks in Reditus let you automatically grant benefits to referred users the moment a referral event happens: discounts, extended trials, bonus features, credits, or priority onboarding.
That makes your affiliate program double-sided. Affiliates earn commissions, and referred customers receive an immediate, tangible benefit.
How it works
- Reditus detects a referral event. Examples:
- referral.created: a new user signs up via an affiliate link
- referral.converted: a referred user becomes a paying customer
- referral.upgraded / referral.downgraded: plan changes for a referred customer
- Reditus sends a webhook to your endpoint.
- HTTP POST request
- JSON payload with referral and customer details
- Signed so you can verify authenticity
- Your system processes the event.
- Validates the signature
- Applies your benefit logic (discounts, extended trials, features, credits, onboarding flags)
- Responds with HTTP 200 on success
Why use webhooks for referral benefits?
1. Increase conversion rates
Referred users convert better when they see an immediate benefit, such as:
- 20% off the first 3 months
- Extended 30-day trial instead of 14 days
This reduces friction and makes the decision feel like a special, time-bound opportunity.
2. Double-sided incentives
The best affiliate programs reward both sides:
- Affiliate: earns commission
- Referred customer: gets a discount, extended trial, or bonus features
Affiliates can then promote you as offering a real deal, not just another product.
3. Full automation
Without webhooks, you would need to:
- Manually check which signups were referred
- Apply discounts or trial changes in your billing system
- Notify customers about their benefits
Webhooks automate this end to end, so benefits are applied instantly and reliably.
Common referral benefit flows
1. Extended trial period
Use case: standard trial is 14 days; referred users get 30 days.
Flow:
- referral.created webhook received
- Your endpoint:
- Looks up or creates the user in your database
- Sets trial_end to 30 days from signup
- Flags the account as referred = true
2. Discount on first payments
Use case: 20% off the first 3 months for referred customers.
Flow:
- referral.converted webhook received when the user becomes paying
- Your endpoint:
- Calls your billing provider (e.g., Stripe) API
- Applies a coupon or promotional code to the subscription
- Stores the discount details on the customer record
3. Bonus features or credits
Use case: temporary access to premium features or usage credits.
Flow:
- referral.created webhook received
- Your endpoint:
- Grants a feature flag (e.g., premium_features_until = now + 30 days)
- Or adds credits (e.g., credits += 1,000)
- Triggers an email explaining what they received and for how long
4. Priority onboarding
Use case: white-glove onboarding for referred customers.
Flow:
- referral.created webhook received
- Your endpoint:
- Creates a task in your CRM or CS tool
- Tags the account as priority_onboarding
- Notifies your customer success team (Slack, email, etc.)
Implementation steps in Reditus
Step 1: Define your benefit rules
Decide what benefit to grant and when. Examples:
- "All referred signups get a 30-day trial instead of 14 days."
- "All referred customers get 20% off their first 3 invoices."
- "Referred users get premium features for 30 days + 500 bonus credits."
Write down three things:
- Trigger event(s): referral.created, referral.converted, etc.
- Conditions: specific plans, countries, affiliates, or campaigns
- Exact benefit: discount %, duration, features, credits
Step 2: Create a webhook endpoint
Implement an HTTPS endpoint on your server, e.g. POST /webhooks/reditus. It needs to do four things.
- Accept JSON. Set Content-Type: application/json and parse the request body as JSON.
- Validate the signature. Use the signing secret from Reditus, recompute the signature from the raw payload, and compare it with the header value using a constant-time comparison.
- Process the event. Inspect event.type (e.g., referral.created) and run the appropriate benefit logic.
- Respond with HTTP 200 on success. Return non-2xx only if you want Reditus to treat it as a failure.
Step 3: Configure webhooks in Reditus
In your Reditus dashboard:
- Go to Integrations / Webhooks
- Add your endpoint URL (e.g. https://yourapp.com/webhooks/reditus)
- Select the events you need, such as:
- Referral created
- Referral converted
- Referral upgraded / Referral downgraded
- Copy the signing secret and store it securely (e.g., environment variable)
Step 4: Implement benefit logic in your handler
Use the flows above as your template. Inspect event.type, then apply the benefit rule you defined in Step 1 and respond with HTTP 200.