Docs

Everything you need to set up your affiliate program with Sled. About a 10-minute read end-to-end.

Get live in 5 minutes

1. Quick start

  1. Sign up with your email. You'll get a magic link.
  2. Name your program. Pick a slug (e.g. acme) and set your commission % (default 30%).
  3. Connect Polar in /dashboard/settings — paste your Polar webhook secret, add our webhook URL in Polar.
  4. Drop the tracking script on your marketing site.
  5. Share https://usesled.com/acme/join with potential affiliates. They sign up and get their own link.
Free for your first 3 affiliates. No credit card needed. Upgrade to Pro ($12.00/mo) when you grow.
The flow

2. How attribution works

An affiliate sale follows this chain:

  1. An affiliate shares their link, e.g. https://yoursite.com/?ref=abc1234
  2. A visitor clicks it. Our tracking script reads ?ref=abc1234 and stores it in a ta_ref cookie (90 days default).
  3. The visitor browses your site, eventually buys something through Polar / Stripe / etc.
  4. Your checkout code passes the cookie value as metadata.referral to the payment provider.
  5. The provider fires a webhook to Sled. We look up the referral code → match it to an affiliate → record the conversion + commission.
  6. Your affiliate sees the sale in their dashboard. You see it in yours.
You don't need to add anything to your checkout success page. Attribution happens server-side via the webhook, not client-side.
Recommended

3. Polar.sh integration

Step 1: Add the webhook in Polar

In your Polar dashboardSettings → Webhooks → Add endpoint:

FieldValue
URLhttps://usesled.com/acme/api/webhook/polar
Eventsorder.created, order.refunded, subscription.canceled

Copy the signing secret Polar generates. You'll paste it in your Sled settings.

Step 2: Paste the secret in Sled

Go to /dashboard/settingsPolar webhook secret → paste the value → save.

Step 3: Attach the referral cookie in your checkout

Wherever you create a Polar checkout session, attach the ta_ref cookie value as metadata:

import { Polar } from "@polar-sh/sdk";

const polar = new Polar({ accessToken: process.env.POLAR_ACCESS_TOKEN });

const checkout = await polar.checkouts.create({
  products: [productId],
  successUrl: "https://yourapp.com/thanks",
  metadata: {
    referral: req.cookies.ta_ref ?? "",
  },
});

That's it. When a referred customer pays, the conversion appears in /dashboard within seconds.

Also supported

4. Stripe integration

Webhook URL: https://usesled.com/acme/api/webhook/stripe

Events: checkout.session.completed, charge.refunded

Pass the referral in checkout session metadata:

const session = await stripe.checkout.sessions.create({
  // ...your existing fields
  metadata: { referral: getCookie("ta_ref") || "" },
});

Paste the Stripe signing secret in /dashboard/settingsStripe webhook secret.

Lemon Squeezy, Paddle, Gumroad, etc

5. Other providers

For any provider that can POST JSON, use our generic webhook. POST to https://usesled.com/acme/api/webhook/generic:

{
  "event": "order",
  "orderId": "ord_12345",
  "amount": 4900,
  "email": "customer@example.com",
  "metadata": { "referral": "abc1234" }
}

For refunds:

{ "event": "refund", "orderId": "ord_12345" }

Set a shared secret in /dashboard/settingsGeneric webhook secret → and send it on every request as either X-Webhook-Secret: yoursecret or Authorization: Bearer yoursecret.

Amounts are always in cents.

Drop this on your site

6. Tracking script

Embed on any page where affiliate links land (usually your marketing site root):

<script async src="https://usesled.com/acme/t.js"></script>

What it does, in order:

  1. Reads ?ref=CODE from the URL.
  2. Stores CODE in a ta_ref cookie for the configured attribution window (90 days default).
  3. Pings https://usesled.com/acme/api/click to record the click. We dedupe by IP for 24 hours so refreshes don't inflate stats.

It's less than 1KB minified. No external dependencies. No third-party calls.

The people referring you

7. Affiliates

Inviting them

Share https://usesled.com/acme/join. Anyone with the link can sign up — name + email, that's it. They immediately get their affiliate link.

What they see

  • Their unique referral link
  • Click count, conversion count, revenue, earnings
  • Pending vs paid amounts
  • A form to add payout details (PayPal, Wise, IBAN, crypto wallet) — only after they earn their first commission

Managing them

In /dashboard/affiliates you see everyone's stats — clicks, conversions, owed, payout method.

You move the money

8. Payouts

Sled doesn't move money for you. We track who's owed what — you send payments manually from your own PayPal / Wise / bank / crypto wallet.

This means: no KYC, no payment processing fees, no compliance overhead. Just a clean ledger.

The flow

  1. Open /dashboard/payouts. Affiliates above your minimum threshold appear in Ready for payout.
  2. Each row shows their payment method (PayPal / Wise / Bank / Crypto) and destination (email / IBAN / wallet address).
  3. You send the payment manually.
  4. Click Mark paid in the admin — the affiliate gets an email confirming, their pending balance resets.

Set your minimum payout threshold in /dashboard/settings. Default is $20.

What we send

9. Email notifications

We send 3 transactional emails on your behalf:

  • Welcome — when an affiliate signs up, with their dashboard URL and referral link.
  • First commission — when an affiliate earns their first conversion, prompting them to add payout details.
  • Payout sent — when you click Mark paid in the admin.

Emails are sent from affiliates@usesled.com with your program name in the From field — affiliates see acme · affiliate program” as the sender.

Configurable per-program

10. Settings

SettingWhat it does
Program nameShown to affiliates on signup and in emails.
Commission %Default 30%. Applied to every conversion.
Cookie daysHow long the ref cookie lives. Default 90.
Minimum payoutBelow this, affiliates aren't shown in 'Ready for payout'.
Polar webhook secretRequired to verify Polar webhooks.
Stripe webhook secretRequired if you use Stripe.
Generic webhook secretRequired if you use the generic webhook.
What you get

11. Plans

FreePro
Price$0$12.00/mo intro
then $19.00/mo
Max affiliates3Unlimited
All webhooks
Email notifications
Priority support

See full pricing & FAQ on the pricing page.

Free, AGPL-3.0

12. Self-hosting

Sled is open source under AGPL-3.0. You can self-host it for free — including for your business — instead of using usesled.com.

When self-host vs hosted? Self-host if you want full data control, already manage Node servers, and don't mind doing your own backups + email setup. Use hosted if you want to skip all that — same product, $12/mo.

Quick start

git clone https://github.com/ardakaano/slend
cd sled
npm install
cp .env.example .env
# edit .env (see below)
npx prisma db push
npm run db:seed
npm run dev

Open http://localhost:3000. Sign up at /signup — if email is unconfigured, the magic link prints to your terminal.

Required env vars

VariableDescription
DATABASE_URLPrisma connection — SQLite for dev, Postgres for prod
BASE_URLYour app URL (e.g. https://affiliate.yourapp.com)
RESEND_API_KEYOptional in dev (magic links print to console). Required for email in production.
EMAIL_FROMSender address (must be Resend-verified)

Deploy options

  • VPS + Caddy/nginx — cheapest, full control. SQLite or Postgres both work. ~€4/mo Hetzner runs many apps.
  • Railway / Render — git-push deploys, Postgres add-on one click. ~$5-10/mo.
  • Fly.io — supports persistent volumes, so SQLite works without switching DBs.
  • Vercel — needs hosted DB (Turso for SQLite, Neon for Postgres) because filesystem is read-only.
  • Cloudflare Workers — not supported out of the box. Sled uses Node crypto, which Workers replaces with Web Crypto API. PRs welcome.

Production checklist

  1. Switch from SQLite to Postgres: change provider in prisma/schema.prisma, update DATABASE_URL, run npx prisma migrate dev --name init.
  2. Set RESEND_API_KEY and verify your domain in Resend.
  3. If you want to charge customers (running your own SaaS): set up Polar billing env vars. Otherwise leave empty.
  4. Put a reverse proxy in front (Caddy is simplest) for HTTPS.
  5. Set up DB backups. With SQLite that's a daily file copy; with Postgres your provider usually handles it.

License compliance (AGPL-3.0)

You can use Sled in your business for free. The catch: if you modify the code AND offer it as a network service to others, you must publish your modifications under AGPL-3.0 too. If you just run unmodified Sled (or modify it for internal use only), this doesn't apply.

If AGPL doesn't work for you (e.g. you want to embed Sled in proprietary software), email hey@ardakaanozcan.com for a commercial license.

When things break

13. Troubleshooting

SymptomFix
Webhook not arrivingSend a test event from the Polar dashboard. Check that the webhook URL matches your slug exactly (no typos).
Conversion not recordedYour checkout's metadata.referral was empty. Verify your checkout code reads the ta_ref cookie before creating the session.
Affiliate code not detectedThe ta_ref cookie didn't set. Make sure ?ref= was in the URL when the visitor first arrived on your site, and that the tracking script is loaded.
Affiliate can't access their dashboardThe dashboard URL is their secret — they should bookmark it. If lost, you can find their code in /dashboard/affiliates and resend the URL.
Wrong commission amountCheck the commission % in /dashboard/settings. Changes apply to NEW conversions only.
Free tier signup blockedYou hit the 3-affiliate cap. Upgrade to Pro for unlimited.
Still stuck?

Email support@usesled.com — Pro plan customers get priority response.