Skip to main content

Referrals

Fraud prevention

Pay-per-conversion referrals

Complete referral program infrastructure with value-aligned pricing. Generate unique referral codes, track conversions, manage rewards, and analyze program performance. Pay only for successful conversions—not clicks or operations. Built-in fraud prevention and customizable reward rules.

Overview
Pricing
Usage
Docs
Examples
Create Referral Codecreate.ts
typescript
import { sylphx } from '@sylphx/sdk'

// Generate referral code for a user (free, unlimited)
const referral = await sylphx.referrals.create({
  referrerId: user.id,
  code: 'JOHN25', // Optional custom code
})

console.log('Share link:', referral.shareUrl)
Record Conversion (Billable)convert.ts
typescript
// Only this call is billed ($0.50 per conversion)
await sylphx.referrals.convert({
  code: 'JOHN25',
  referredUserId: newUser.id,
  value: 99.99, // Optional: for percentage-based rewards
})

// Rewards automatically applied to both parties
Unified Conversion (Recommended)unified.ts
typescript
// Best practice: use unified tracking
// Auto-records in Analytics + Referrals + CDP
sylphx.track('conversion', {
  type: 'purchase',
  value: 99.99,
  referralCode: 'JOHN25', // Auto-attributes if present
  destinations: ['google_ads', 'meta'],
})

Looking for more examples?

View on GitHub