Getting Started
Overview
Quickstart
Authentication
Plan Access
Rate Limits
Errors
Pagination
Idempotency
Changelog
Guides
REST API: Campaigns
Affiliates
Conversions
Affiliate Teams
SCALE
Coupons
Payouts
Shopify Apps
Other
Webhooks
MCP Server (AI)
One script tag and, for checkouts your server creates, one field. Written for you and for your coding agent: connect your payment provider, pass the referral to checkout, and check it with a test sale.
5 min read
Using a coding agent?
Tell it: “Add LinkJolt affiliate tracking to this app, following linkjolt.io/developers/quickstart.md”. That address is this page as plain markdown. Steps marked “You, in your browser” are yours; the agent does the rest.
LinkJolt tracks the sales your affiliates bring in through their links and discount codes, straight from your own payment provider, gives affiliates a portal, and lets you pay them through Stripe payouts or a PayPal or Wise file. LinkJolt never holds your money. There is nothing to install from npm.
Sign up at https://www.linkjolt.io/auth/sign-up. Plans start at $19.99 a month, with a 7-day free trial (card required) and 0% of your sales taken.
Create a campaign: the commission (for example 20% of every payment, renewals included) and the page affiliate links send people to.
Working in Claude Code or Codex? Add the LinkJolt connector (below) and your agent can read your setup and tracking script and name the business before you pick a plan, then create the campaign once your trial has started. You sign in once in the browser.
In LinkJolt, open Integrations and pick your provider. This is the step that sends sales to LinkJolt, and it happens in your browser: an agent cannot approve it for you.
Put the script on every page of the site, in the root layout. Your merchant id is in the script tag shown on Integrations (or ask the connector for it).
When a visitor arrives through an affiliate link (?tc=...&aff=...), the script keeps the referral for 30 days and exposes it as window.linkjolt.referral, a string like tc_abc_aff_xyz_cid_123. On a visit without an affiliate it is empty.
import Script from 'next/script';
// inside <body> of the root layout
<Script src="https://www.linkjolt.io/api/tracking.js?id=YOUR_MERCHANT_ID" strategy="afterInteractive" />TypeScript projects can declare the global once:
// global.d.ts, so window.linkjolt type-checks
interface Window {
linkjolt?: { referral: string | null };
}Find how the app takes payment and make the one change for it. Never rename the field or put the referral anywhere else: that field is what LinkJolt reads. Renewals, refunds and plan changes are tracked from the first payment, so there is nothing to build for them.
Read window.linkjolt.referral in the browser, send it with the checkout request, and set it as client_reference_id on the Checkout Session.
How to spot it: the stripe package, and stripe.checkout.sessions.create in a route or server action. Full steps: /developers/quickstart/stripe.md
// 1. In the browser: send the referral with your checkout request
const referral = window.linkjolt?.referral || '';
const res = await fetch('/api/create-checkout', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ priceId: 'price_123', referral }),
});
window.location.href = (await res.json()).url;
// 2. On your server: read it and pass it when you create the session
// (a Next.js route handler; with Express, add app.use(express.json()) and read req.body)
const { priceId, referral } = await req.json();
const session = await stripe.checkout.sessions.create({
line_items: [{ price: priceId, quantity: 1 }],
// ...your other options (mode, success_url)
client_reference_id: referral || undefined,
});
return Response.json({ url: session.url });Stripe Checkout Affiliate Tracking in Next.js (client_reference_id) (1:46)
Plumquote is a demo account made for this tutorial.
Watch on YouTubeThis sale came through a Stripe Checkout session that a Next.js app creates in its own code, and it's credited to the affiliate who sent the customer. It takes two changes. Here they are.
In LinkJolt, connect Stripe on the Stripe tab. Then, under How do your customers pay, pick Checkout from my code.
Step three has two parts. The first is the tracking script, in your root layout. There's a separate video on that.
The second: pass the affiliate when you create the Checkout session. The browser reads window.linkjolt.referral, and sends it to your server with the checkout request, as JSON.
Send it with the content type header, or most servers won't read it.
In the page with your buy button, read the referral, and send it in the body of the request.
On your server, read it from the body, and set it as the session's client_reference_id. When a visitor didn't come through an affiliate link, it's empty, and no commission is created.
Using TypeScript? Declare window.linkjolt once, in a global.d.ts file.
And if your app already uses client_reference_id for its own value, keep it, and put the referral in the session's metadata as linkjolt_ref instead. LinkJolt reads either.
Here's a reader arriving through Leo's link. They click subscribe, and the server creates the session with Leo's reference.
They pay on Stripe's checkout as usual, and the sale reaches LinkJolt.
Credited to Leo: fifteen dollars, three dollars of commission, waiting for your approval.
That's the setup. Try LinkJolt free for seven days at linkjolt.io.
Nothing beyond the tracking script: it adds the referral to every buy.stripe.com link and sets client-reference-id on the pricing table and buy button.
How to spot it: buy.stripe.com links, <stripe-pricing-table> or <stripe-buy-button>. Full steps: /developers/quickstart/payment-links.md
Pass the referral as customData.linkjolt when opening Paddle Checkout.
How to spot it: @paddle/paddle-js, Paddle.Checkout.open or paddle.Checkout.open. Full steps: /developers/quickstart/paddle.md
paddle.Checkout.open({
items: [{ priceId, quantity: 1 }],
customData: { linkjolt: window.linkjolt?.referral || '' },
});Checkout links need nothing beyond the script. A checkout your server creates sets the referral as metadata.reference_id.
How to spot it: @polar-sh/sdk, or links to buy.polar.sh. Full steps: /developers/quickstart/polar.md
// 1. In the browser: send the referral with your checkout request
const referral = window.linkjolt?.referral || '';
const res = await fetch('/api/create-checkout', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ productId: 'prod_123', referral }),
});
window.location.href = (await res.json()).url;
// 2. On your server: set it as metadata.reference_id when you create the checkout
// (a Next.js route handler; with Express, add app.use(express.json()) and read req.body)
const { productId, referral } = await req.json();
const checkout = await polar.checkouts.create({
products: [productId],
successUrl: 'https://example.com/thanks',
// Polar refuses an empty metadata value: leave the key out when there is no referral
metadata: referral ? { reference_id: referral } : {},
});
return Response.json({ url: checkout.url });Payment links need nothing beyond the script. A checkout your server creates sets the referral as metadata.linkjolt_ref.
How to spot it: the creem package, creem.io payment or product links. Full steps: /developers/quickstart/creem.md
// 1. In the browser: send the referral with your checkout request
const referral = window.linkjolt?.referral || '';
const res = await fetch('/api/create-checkout', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ productId: 'prod_123', referral }),
});
window.location.href = (await res.json()).url;
// 2. On your server: add it to the checkout you create (Creem's TypeScript SDK)
// (a Next.js route handler; with Express, add app.use(express.json()) and read req.body)
const { productId, referral } = await req.json();
const checkout = await creem.checkouts.create({
productId,
successUrl: 'https://example.com/thanks',
metadata: referral ? { linkjolt_ref: referral } : undefined,
});
return Response.json({ url: checkout.checkoutUrl });Nothing beyond the tracking script: it adds the referral to those links.
How to spot it: links to *.lemonsqueezy.com, *.gumroad.com or gum.co. Full steps: /developers/quickstart/payment-links.md
Open the site with ?tc=TEST&aff=TEST and run window.linkjolt.referral in the browser console: it should print tc_TEST_aff_TEST.
For a real check, use the test link on the Integrations page and buy in your provider's test mode. With Set up with Stripe, a Stripe test-mode purchase is recorded as a test sale (a Stripe sandbox is a separate account, so it is not). Creem test-mode purchases and Paddle sandbox purchases with a sandbox key connected are test sales too. Test sales are listed under Commissions → Test sales, apart from real commissions.
With the LinkJolt connector, the agent checks it itself: check_tracking fetches the page and looks for this account's tag, and says whether a browser has run the script, whether the payment provider is connected and whether the test purchase arrived.
The LinkJolt connector lets an agent read your setup and your own tracking script and name the business, and once your trial has started, create the campaign and invite your first affiliate. You sign in once in the browser; there is no API key to paste. Other clients, Cursor included, are on the connector page.
claude mcp add --transport http --scope user linkjolt https://www.linkjolt.io/api/mcp
# then inside Claude Code: /mcp, pick linkjolt, authenticateThe LinkJolt skill walks any agent through this page. It installs in Claude Code, Codex, Cursor and other agents:
npx skills add https://www.linkjolt.io