Skip to main content
This guide gets a working affiliate program live: track referral clicks, attribute sales (with or without Stripe), and read the commissions you owe.
1

Create an API key

In your dashboard, open Developers → API keys (referralful.com/dashboard/developers) and create one. The secret is shown once. See Authentication for how to send it.
2

Add the tracking snippet

Drop this into the <head> of every page on your site. It records referral clicks and exposes the referral id as window.AffID.referral:
<script async
  src="https://cdn.jsdelivr.net/gh/mihir-kanzariya/affiliate-script@0.3.0/dist/aff.min.js"
  data-account="YOUR_ACCOUNT_SLUG"
  data-track-url="https://referralful.com"></script>
Find your exact snippet in Dashboard → Settings → Tracking snippet.
3

Attribute the sale

Tell Referralful which affiliate to credit when a customer pays.
Pass the captured referral as client_reference_id on the Checkout Session:
const session = await stripe.checkout.sessions.create({
  client_reference_id: referral, // = window.AffID.referral from the browser
});
Conversions and recurring commissions track automatically from Stripe.
4

Add affiliates

Let people join through your signup page, or create them via the API:
curl https://api.referralful.com/v1/affiliates \
  -u rfl_live_your_secret: \
  -H "Content-Type: application/json" \
  -d '{ "email": "alex@example.com", "first_name": "Alex" }'
The response includes the affiliate’s links (their tracking tokens) to share.
5

Verify it works

Make a test purchase through an affiliate link, then read the data back:
curl https://api.referralful.com/v1/referrals   -u rfl_live_your_secret:
curl https://api.referralful.com/v1/commissions -u rfl_live_your_secret:
You should see a referral move to conversion and a commission appear.

Coming from Rewardful?

Change the base URL and key, and your existing code works unchanged. See Switch from Rewardful.