Prerequisites
- A Stripe account (for payment tracking)
- A website where you sell your product (for the tracking script)
Setup
1
Create your account
Sign up at agentref.co. No credit card required.After signing up, you’ll land on the onboarding flow that walks you through the next steps.
2
Connect Stripe
Click Connect Stripe in the onboarding flow. You’ll be redirected to Stripe’s OAuth page to authorize AgentRef.AgentRef uses Stripe Connect to:
- Listen for payment events (checkout completions, invoice payments, refunds)
- Match payments to affiliate referrals
- Track subscription renewals for recurring commissions
3
Create your program
After connecting Stripe, create your first affiliate program. Here are recommended starting settings:
4
Install the tracking script
Add the AgentRef tracking script to your website. Place it in your Replace
<head> tag or before the closing </body> tag:YOUR_PROGRAM_ID with the ID shown in your program settings.The script handles:- Capturing affiliate referral codes from URL parameters
- Setting first-party attribution cookies (
agentref_cid,agentref_pid,agentref_src) - Providing
getCheckoutMetadata()for Stripe session integration
client_reference_id.For server-created Checkout Sessions: Pass the metadata to your server:5
Get your API key
Go to Settings > API Keys in your AgentRef dashboard and create a new key.
- Merchant keys start with
ak_live_and can access your programs, applications, affiliates, conversions, payouts, webhooks, and marketing resources based on selected scopes.
6
Make your first API call
Verify everything works by fetching your program stats:You should see your program in the response. If you get a
401 error, double-check your API key.Verify your setup
After completing the steps above, confirm everything is working:-
Tracking script loaded. Open your website, open browser DevTools, and check the Network tab for a request to
agentref.co/api/tracking/script.js. It should return200. -
Cookies set. Visit your site through a test referral link (create one in the dashboard). Check DevTools > Application > Cookies for
agentref_cidandagentref_pid.- API responds. The API call from the previous step returns your program data.
- Stripe connected. Your AgentRef dashboard shows the Stripe connection as active.
What’s next
Agent Setup
Connect AgentRef to Claude, Codex, Cursor, OpenClaw, or any AI assistant.
Invite Affiliates
Start recruiting affiliates to your program.
Marketing Resources
Publish campaign material for affiliates.
API Reference
Explore the full REST API documentation.