One tag and done
The tag goes in your site's head. The line goes wherever you already create Stripe customers. That's the whole integration — referral links point at your own domain, so AffiliateKit never sits between an affiliate and your site.
1. Connect Stripe
In your campaign's settings, choose Connect Stripe and authorize the account that charges your customers. AffiliateKit watches that account for successful charges and refunds from that moment on. It never sees card numbers, and you can disconnect at any time.
2. Add the snippet
Paste this into your site's <head>, with the token from your campaign. That token is the only thing to configure, and it means the snippet works on any domain you run it from — production, staging, or a custom domain.
<script
src="https://www.affiliatekit.co/affiliatekit.js"
data-affiliatekit-token="YOUR_CAMPAIGN_TOKEN"
defer></script>
No dependencies, no build step. When a visitor arrives on a referral link the snippet stores the affiliate's code in a first-party cookie named _ak_ref, then cleans ?via= out of the address bar. The cookie lasts as long as the attribution window you set on the campaign, and is scoped to your root domain, so a visitor who lands on your marketing site and signs up on app. keeps their referral.
3. Share referral links
Affiliate links are your own URLs with one parameter added. Every approved affiliate gets theirs on their campaign page.
https://yoursite.com/?via=AFFILIATE_CODE
The link goes straight to you — no redirect through AffiliateKit, and your domain is what people see and share. It works on any page of your site, so an affiliate can point at whichever page suits their audience.
4. Tag the Stripe customer
This is the one line that matters. When your app creates the Stripe customer, read the code from the snippet and put it in the customer's metadata.
// in the browser, when they sign up
window.AffiliateKit.token() // => "AFFILIATE_CODE" or null
// then, wherever you create the Stripe customer
stripe.customers.create({
email: user.email,
metadata: { affiliatekit_via: token }
})
That is the whole join. Every charge Stripe reports for that customer — first payment and every renewal after it — carries the affiliate with it, so recurring commissions need no further work. Send the token to your backend however you already send signup data; AffiliateKit does not care when or how you do it.
5. Record signups (optional)
If you want affiliates to see signups before those signups pay, post them. Commissions work without this.
POST https://www.affiliatekit.co/api/signups
{ "campaign_token": "YOUR_CAMPAIGN_TOKEN", "referral_code": "AFFILIATE_CODE", "external_id": "your_user_id" }
Call it from your backend or the browser. external_id is optional and is only used to make the call idempotent, so a retry does not double-count. We do not want your users' email addresses and do not accept them here.
Content Security Policy
If your site sets a CSP, allow AffiliateKit in two directives — one to load the snippet, one to let it read your campaign's attribution window.
script-src https://www.affiliatekit.co
connect-src https://www.affiliatekit.co
What gets stored
Which affiliate earned a signup, and the charges Stripe reports for customers you tagged — amount, currency, charge id, and Stripe's customer id. No email addresses, no names, no browsing history. The full list lives in the privacy policy.
Stuck on something? Email chris@affiliatekit.co.