Guides

REST API: Campaigns

Affiliates

Conversions

Affiliate Teams

SCALE

Coupons

Payouts

Other

Webhooks

MCP Server (AI)

Add an affiliate program to your app

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.

Beginner

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.

1. Create your LinkJolt account

You, in your browser

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.

2. Connect where you take payment

You, in your 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.

  • Stripe: Integrations → Stripe → Set up with Stripe, then approve once on Stripe. No webhook to create, no secret to paste.
  • Paddle: Integrations → Paddle → paste a Paddle API key that can write notification settings. LinkJolt creates the notification destination.
  • Polar: Integrations → Polar → approve once. LinkJolt creates the webhook.
  • Creem: Integrations → Creem → paste a Creem API key. LinkJolt creates the webhook.
  • Lemon Squeezy and Gumroad: add the webhook LinkJolt shows on that Integrations tab.
  • Everything else: follow that platform's Integrations tab; the platform files in step 4 have the same steps.

3. Add the tracking script

Your agent, in the code

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 };
}

4. Pass the referral to checkout

Your agent, in the code

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.

Stripe Checkout, created by your server

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

// Browser: the page that starts checkout
const referral = window.linkjolt?.referral || '';
const res = await fetch('/api/checkout', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ priceId, referral }),
});

// Server: where the Checkout Session is created
const { priceId, referral } = await req.json();
const session = await stripe.checkout.sessions.create({
  // ...your existing options
  client_reference_id: referral || undefined,
});

Stripe Payment Links, pricing table or buy button

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

Paddle Billing (Paddle.js checkout)

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 || '' },
});

Polar

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

const checkout = await polar.checkouts.create({
  products: [productId],
  successUrl,
  metadata: referral ? { reference_id: referral } : {},
});

Creem

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

import { Creem } from "creem";
const creem = new Creem({ apiKey: process.env.CREEM_API_KEY });

const checkout = await creem.checkouts.create({
  productId: "prod_123",
  successUrl: "https://example.com/thanks",
  metadata: { linkjolt_ref: referral },   // the value from window.linkjolt.referral
});
// send the customer to checkout.checkoutUrl

Lemon Squeezy or Gumroad links

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

Other platforms

5. Check it with a test sale

Your agent, in the code

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.

Rules for agents

  • Use the provider's own checkout; LinkJolt does not replace it, and no npm package is needed.
  • There is no referral table, commission logic or payout code to write: LinkJolt records each sale from the payment provider, works out the commission, reverses it on a refund, gives affiliates their sign-up page and portal, and pays them through Stripe payouts or a PayPal or Wise file.
  • Keep secrets server-side. The tracking script is public; API keys are not.
  • Connecting the payment provider and starting a plan are the person's steps in the browser. Say which page to open, then carry on with the code.

Let your agent do the LinkJolt side

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, authenticate

The 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