Affiliate Program (Beta Phase).
Enter your creator handle or username to generate your personalized tracking link for tinyfiles.tv.
| Referral ID | Source Page | Status | Commission |
|---|---|---|---|
| ref_9821_synth | /offerwall.html | Active Subscriber | +$12.00 |
| ref_4410_dev | /index.html | Active Subscriber | +$18.50 |
| ref_1092_retro | /algo-feed.html | Pending Trial | $0.00 |
- 30% Revshare: Locked in for life for all beta cohort affiliates.
- Zero Ad Bloat: Promote a clean, zero-cookie indie web platform with confidence.
- Direct Payouts: Automated monthly accounting with zero hidden fees.
Need custom promotional banners, API tokens, or direct payout arrangements during the beta phase?
Email Affiliate DeskRight now this page is local-only — the link is built in the browser with ?ref=handle&beta=true and the ledger is static demo rows. This backend is the map to make it real: same 30% / 90-day / $50 rules, but with server-side attribution, commissions, and payouts. Proposed, not connected.
01 / Files to create
api/affiliates/register.php POST /api/affiliates/register api/affiliates/me.php GET /api/affiliates/me api/affiliates/links.php POST /api/affiliates/links / GET /api/affiliates/links api/affiliates/track.php GET /api/affiliates/track?ref=handle (first-party, 90-day) api/affiliates/conversion.php POST /api/affiliates/conversion api/affiliates/ledger.php GET /api/affiliates/ledger api/affiliates/payouts.php GET /api/affiliates/payouts / POST /api/affiliates/payouts/request sql/affiliates_tables.sql
Keep the tinyfiles PHP pattern: each endpoint loads /api/bootstrap.php, uses json_in() / json_out(), member session for auth, prepared PDO statements.
02 / Database tables
-- sql/affiliates_tables.sql
affiliates
id CHAR(36) PRIMARY KEY
member VARCHAR(80) NOT NULL
handle VARCHAR(32) NOT NULL UNIQUE -- e.g. synthwave_dev, lowercased, [a-z0-9_]
status ENUM('pending','active','suspended') NOT NULL DEFAULT 'pending'
payout_method ENUM('paypal','btc') NULL
payout_address VARCHAR(255) NULL
created_at DATETIME
affiliate_links
id CHAR(36) PRIMARY KEY
affiliate_id CHAR(36) NOT NULL
landing_url VARCHAR(2048) NOT NULL -- / , /offerwall.html, /algo-feed.html
ref_code VARCHAR(32) NOT NULL -- = handle
created_at DATETIME
affiliate_clicks
id BIGINT AUTO_INCREMENT PRIMARY KEY
affiliate_id CHAR(36) NOT NULL
landing_url VARCHAR(2048)
referrer VARCHAR(2048) NULL
clicked_at DATETIME
-- no IP / fingerprint stored, aggregate counts only
affiliate_referrals
id CHAR(36) PRIMARY KEY
affiliate_id CHAR(36) NOT NULL
referred_member VARCHAR(80) NOT NULL
first_click_at DATETIME
converted_at DATETIME NULL
attribution ENUM('first_touch','last_touch') NOT NULL DEFAULT 'first_touch'
expires_at DATETIME -- first_click + 90 days
UNIQUE (referred_member)
affiliate_commissions
id CHAR(36) PRIMARY KEY
affiliate_id CHAR(36) NOT NULL
referral_id CHAR(36) NOT NULL
amount DECIMAL(10,2) NOT NULL -- 30% of subscription / API sale
status ENUM('pending','approved','paid','reversed') NOT NULL DEFAULT 'pending'
created_at DATETIME
affiliate_payouts
id CHAR(36) PRIMARY KEY
affiliate_id CHAR(36) NOT NULL
amount DECIMAL(10,2) NOT NULL -- must be >= 50.00
method ENUM('paypal','btc') NOT NULL
status ENUM('requested','approved','paid','failed') NOT NULL DEFAULT 'requested'
requested_at DATETIME
paid_at DATETIME NULL
03 / API endpoints & request flow
POST /api/affiliates/register
{ "handle": "synthwave_dev", "payout_method": "paypal", "payout_address": "..." }
- validate handle: ^[a-z0-9_]{3,32}$, lowercased, unique
- create affiliates row, status = pending -> active after review
- returns { "ok": true, "affiliate_id": "uuid", "handle": "synthwave_dev" }
POST /api/affiliates/links
{ "landing_url": "https://tinyfiles.tv/offerwall.html" }
- returns { "ok": true, "url": "https://tinyfiles.tv/offerwall.html?ref=synthwave_dev&beta=true" }
GET /api/affiliates/track?ref=synthwave_dev
- first-party only, sets tf_ref cookie / localStorage, 90-day Max-Age, SameSite=Lax, Secure
- logs 1 aggregate click, no fingerprint, no third-party cookie
- redirects to landing_url without ref in final URL if you want clean URLs
POST /api/affiliates/conversion
{ "referred_member": "...", "plan": "creator_monthly", "amount": 40.00 }
- called by subscription / checkout webhook, NOT by browser
- checks affiliate_referrals, 90-day window, creates affiliate_commissions row
- commission = amount * 0.30
GET /api/affiliates/ledger
- returns clicks, referrals, commissions, pending balance for current affiliate
POST /api/affiliates/payouts/request
{ "method": "paypal" }
- server checks balance >= 50.00, creates payout, locks commissions to payout
04 / Attribution, fraud & payout rules
Attribution: 1. Visitor clicks ?ref=handle -> track.php stores first-party tf_ref (90 days) 2. Visitor signs up -> conversion checks tf_ref, creates affiliate_referrals 3. If referred_member already has a referral, do NOT re-attribute 4. If 90 days pass with no conversion, referral expires Fraud controls: - Self-referral blocked: referred_member != affiliate member - Rate-limit track.php via nginx, same as other API endpoints - Require approved affiliate status before commissions become approved - Reversal: if subscription refunds / chargebacks, commission -> reversed Payouts: - Threshold: $50.00 minimum, monthly batch - Ledger must balance: sum(approved commissions) - sum(paid payouts) = pending balance - Payout request is idempotent — use Idempotency-Key header, don't double-pay
Generic placeholder for now: the front-end ledger in this page is static demo data. When the API exists, replace it with GET /api/affiliates/ledger and show “Simulation” when the API is unavailable.
05 / Front-end integration contract
// When API exists, replace the local generate handler with:
POST /api/affiliates/links
{ "landing_url": "https://tinyfiles.tv/offerwall.html" }
-> { "ok": true, "url": "https://tinyfiles.tv/offerwall.html?ref=synthwave_dev&beta=true" }
GET /api/affiliates/ledger
{
"ok": true,
"mode": "live", // or "simulation"
"handle": "synthwave_dev",
"balance_pending": 30.50,
"rows": [
{ "referral_id": "ref_9821_synth", "source": "/offerwall.html", "status": "Active Subscriber", "commission": 12.00 }
]
}
Recommended states: loading, live, simulation, empty, validation error, unauthorized, server unavailable. Never show fabricated live earnings as real revenue.