Referral System Test Page

Step 1: Select & Click a Referral Link

Loading referral codes...

Click one of these links to simulate a user arriving via a referral:

Homepage with referral:/?ref=FASTEDDY2026
This page with referral:/test-referral?ref=FASTEDDY2026
Dashboard with referral:/dashboard?ref=FASTEDDY2026

The middleware will detect the ?ref= parameter, set a tracking cookie, record the visit, and redirect to the configured tenant URL (or clean URL if none set).

Step 2: Current Referral Status

Loading...

Step 3: Simulate User Signup

This will create a test user and attribute them to the affiliate from the cookie:

After signup, the user will be linked to the affiliate. Check the dashboard to see the referral count increase.

Recent Visits (Last 10)

No visits recorded yet. Click a referral link above!

How the Full Flow Works

1. Referral Link Click: User visits your site with ?ref=CODE

2. Middleware Detection: Next.js middleware detects the ref param

3. Cookie Set: HTTP-only cookie stored (30 days by default)

4. Visit Recorded: Visit logged with IP hash, user agent, landing page

5. User Signs Up: During registration, the attribution API is called

6. Attribution: User linked to affiliate, visit marked as converted

7. Payment: When user pays (Stripe webhook), commission is calculated

8. Payout: After lock period, commission becomes payable to affiliate