Skip to content

Quickstart

Get from a new account to a test commission in about ten minutes. You'll do everything in test mode first, with Stripe test payments or the Polar sandbox, then switch to live.

You need a Stripe or Polar account and access to your site's HTML and your app's signup code.

1. Create your program

Sign up and create a workspace. Refenue makes a program with a default partner group paying 30% of each payment for a customer's first 12 months, and a partner portal at <your-name>.refenue.co. You can change all of it later.

Turn on Test mode with the switch at the top right of the dashboard. Test mode keeps its own customers, sales, commissions, payouts, API keys and webhooks, so nothing you do here touches live data. Partners are shared by both modes.

2. Connect Stripe or Polar

In the dashboard, open Developers and follow the steps for your billing provider. For Stripe, create a restricted key in Stripe's test mode and paste it in. For Polar, create an organization access token in the Polar sandbox. Refenue adds a webhook to your account and starts reading payments. The Stripe guide and Polar guide have the exact permissions.

3. Add the script

Still on Developers, under Install tracking, copy the script tag. Put it in the <head> of every page on your site and in your app:

<script async src="https://refenue.co/r.js" data-refenue="pk_test_..."></script>

The pk_ key is public and safe to ship. When a visitor arrives through a partner link like yoursite.com/?via=jane, the script records the click and keeps the referral in a first-party cookie for 60 days.

Optional attributes:

AttributeDefault
data-paramviaThe link parameter partners use
data-cookie-days60How long a referral lasts

Partners can add &sub=youtube to a link to see which of their channels sent a click.

4. Record signups

Right after someone creates an account in your app, call:

await window.refenue?.signup(user.email, { externalId: user.id });

This turns the referred visitor into a lead tied to the partner. Visitors who didn't come through a partner link are ignored. Payments from this email are credited to the partner from now on.

If you'd rather do this on your server, send the referral (window.refenue.referral) with your signup request and call POST /leads.

5. Pass the referral to Checkout (optional)

Refenue matches payments to leads by email, so this step is optional. Adding it makes matching certain even when someone pays with a different email:

// Server, when creating the Stripe Checkout session
const session = await stripe.checkout.sessions.create({
  // ...your existing options
  client_reference_id: referral ?? undefined,
  metadata: { refenue_referral: referral ?? "" },
});

Send window.refenue.referral from the browser with the checkout request. On Polar, put the same refenue_referral in the checkout's metadata; the Polar guide shows how.

6. Make a test sale

  1. Open Partners and add yourself as a partner with another email.
  2. Visit your site through your partner link, e.g. yoursite.com/?via=your-name.
  3. Sign up in your app, then pay with Stripe's test card 4242 4242 4242 4242, or place a sandbox order in Polar.
  4. Open Commissions: the commission is there, pending until its hold period ends.

Developers → Check installation checks each step and tells you what's missing if a sale doesn't show up.

7. Go live

Switch the dashboard to live mode, connect your live Stripe account with a live restricted key (or your production Polar organization with a production token), and swap pk_test_ for pk_live_ in the script. Then invite your partners from Partners: each gets a link and access to the portal.

Next steps

  • Set commission rules per group and product in Program.
  • Brand the portal and add your own domain in Portal.
  • Report sales from other billing systems with the API.
  • When commissions are due, create a payout run in Payouts.