The referral module gives each user a referral code, preserves first-touch attribution for 30 days, and tracks referred signups through conversion, reward, and reversal states.
Lifecycle
| Status | Meaning |
|---|---|
signed_up | A new account was attributed to a referral code |
converted | The referred user completed a qualifying payment |
rewarded | The reward was issued |
reversed | The qualifying payment was refunded or disputed |
Configuration
REFERRAL_REWARD_AMOUNT="10"
REFERRAL_REWARD_TYPE="credit"
REFERRAL_REWARD_TYPE supports credit or discount:
creditadds the configured number of usage credits to both the referrer and the referred user.discountcreates a one-time, account-scoped percentage promotion for both users.
Referral attribution is attached when a new account is created through a referral link. Signing in to an existing account does not attach a referral. Rewards for both users are issued after the referred account's first qualifying payment.
The amount must be a whole number. It is interpreted as credits for credit and percentage points for discount (1–100). A value of 0 disables rewards.
Integration
First-touch attribution is attached when a new account is created, then remains pending until its first qualifying payment. Successful payments issue rewards idempotently; full refunds and lost disputes reverse them, while partial refunds and won disputes do not.
Feature flag
ENABLE_REFERRALS="false"
When disabled, referral dashboard and API surfaces return 404.