Skip to content
Saasflare.dev
Get started
Partner Afirst touch · wins
Partner Blater click · ignored
Saasflare/affiliate
WorkersD1
click · cookie · commission ledger
Your appsign-up · order
Affiliate

Your referral program, on your own edge.

A link redirect, a first-touch lock, and two REST endpoints. Clicks, attribution and commissions live in your Cloudflare account — not in a third party that takes a cut of every payout.

  • First-touch attribution
  • Two REST endpoints
  • Runs in your account
  • Early access
How it works

Attribution without the platform tax.

Referral SaaS charges a percentage of the revenue it helped you earn, forever. This is the same machinery, deployed once, under your own domain.

Two endpoints, that is the integration

Tell it who signed up, then tell it who paid. It resolves the referrer, locks first touch, and computes the commission — idempotently, so a retried webhook never pays twice.

First touch, then locked

The link redirect drops a first-party cookie with a 30-day window and records the click server-side. A typed referral code always beats the cookie, and once a partner is attributed to a user, that link cannot be overwritten.

Books you can audit

Clicks, conversions, GMV and commission all land in your own D1 tables. Settlement is recorded rather than executed — you keep control of when and how partners actually get paid.

The path of one referral

Click, sign-up, order, commission.

Four moments, each one a row in your database. Nothing about it is magic, which is exactly why you can reason about the numbers.

  1. 1

    A partner shares a link

    Their code lives at /r/<code> on your own domain.

  2. 2

    The redirect records the click

    A first-party cookie is set; the click is stored with hashed UA and IP prefix.

  3. 3

    Your app reports the sign-up

    POST the new user and the referrer. First touch is locked here.

  4. 4

    Your app reports the order

    POST the order and its amount. The commission is computed once.

Commission is fixed-CPA on a customer’s first order; later orders still record GMV but earn nothing.

The merchant API

Two authenticated POSTs.

No SDK to install, no snippet to paste on your marketing site. Your backend already knows when someone signs up and when someone pays — just tell it.

your-backend.ts
// 1. a visitor signed up — lock first touch
await fetch('https://affiliate-server.saasflare.dev/api/v1/attribution', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${MERCHANT_KEY}`,
  },
  body: JSON.stringify({ externalUserId: user.id, ref: cookies.aff_ref }),
});

// 2. they paid — record the order, compute the commission once
await fetch('https://affiliate-server.saasflare.dev/api/v1/conversions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${MERCHANT_KEY}`,
  },
  body: JSON.stringify({
    externalOrderId: order.id,
    externalUserId: user.id,
    amount: order.totalCents,
  }),
});
Who runs one

Anywhere someone vouches for you.

Creator and KOL programs

Give each creator a code, watch which audience actually converts rather than which one posts the most.

SaaS referral loops

Let existing customers bring the next ones, and pay them a fixed bounty on the first order.

Launch partners

Newsletters, podcasts and directories each get a link, and you find out which listing was worth the sponsorship.

Agencies and resellers

Track the accounts an agency brings in, and keep the settlement ledger somewhere you can actually export.

Affiliate is in early development. The redirect, attribution, commission and merchant API run and are covered by tests; the partner portal, admin console and payout screens are still being built. Commission is fixed-CPA on first orders, and payouts are recorded for you to settle manually — there is no Stripe Connect integration.

SAASFLARE NEWSLETTER

Follow what we’re building.

We’ll only email you when we have a product update or industry news genuinely worth your attention. No inbox noise—only content that’s useful to you.

Product updates and selected industry news. Unsubscribe in one click.