← Back to docs

Complete setup tutorial

A straightforward guide to launch your affiliate program in under 15 minutes.

1. Create your workspace

Go to /onboarding and create your workspace. Enter your email, password, workspace name, and commission rate. Click "Create workspace & connect Stripe".

2. Connect Stripe

You'll be redirected to Stripe to authorize the connection. Use your existing Stripe account—Referish will track invoices from your connected account for commission attribution.

Important: In Stripe Dashboard → Webhooks, ensure your webhook has "Listen to events on connected accounts" enabled.

3. Add a Become an affiliate page

In your dashboard, go to Integrations. Copy your invite link:

http://localhost:3000/portal/join?account=YOUR_ACCOUNT_ID

Add a page on your site (e.g. /affiliates or /partners) with a link to that URL:

<a href="http://localhost:3000/portal/join?account=YOUR_ACCOUNT_ID" target="_blank" rel="noopener">
  Become an affiliate
</a>

Replace YOUR_ACCOUNT_ID with your actual account ID from the Integrations page.

4. Set your signup URL

In Settings, set the Referral signup URL. This is the page where customers land when they click an affiliate's link. For example:

https://app.yoursaas.com/signup

Each affiliate will share links like https://app.yoursaas.com/signup?ref=ABCD1234. The ref is their unique code—you need to capture it and pass it to Stripe.

5. Add the attribution code

Add this snippet to your signup/pricing page (or any page where customers might land from an affiliate link). It captures the ref from the URL and stores it in a cookie:

// Capture ref when user lands from affiliate link
const params = new URLSearchParams(window.location.search);
const ref = params.get('ref');
if (ref) {
  document.cookie = `affiliate_ref=${ref}; path=/; max-age=2592000`;
}

At checkout, when you create a Stripe customer or subscription, add the ref to metadata:

// Read ref from cookie (or session) and pass to Stripe
const ref = document.cookie.match(/affiliate_ref=([^;]+)/)?.[1];

const customer = await stripe.customers.create({
  email: customerEmail,
  metadata: { ref: ref || undefined },
});

See the Attribution integration guide for more details and server-side examples.

6. Invite your first affiliate

Share your invite link with someone (or create a test affiliate yourself). They click the link, sign up with email/password, and get their own unique referral code and link.

Each affiliate has a different link—e.g. Affiliate A gets ?ref=ABCD1234, Affiliate B gets ?ref=WXYZ5678. The attribution code you added captures whichever ref is in the URL when a customer lands.

7. Test the full flow

To verify everything works:

  1. Have an affiliate share their link (with ?ref=CODE)
  2. Open that link in a new browser/incognito—confirm the ref is captured (check cookie or your logs)
  3. Complete a test purchase with that ref in Stripe metadata
  4. Check Commissions in your dashboard—the commission should appear

You can also use the Verify integration button on the Integrations page to run an automated check.