Showing

How do I set up affiliate tracking with Stripe?

Add your LinkJolt webhook endpoint in Stripe and save the signing secret, then add the tracking script and pass the referral to your checkout. LinkJolt then records each Stripe sale and attributes it to the referring affiliate.

2 min read
Updated Sep 5, 2026

Connecting Stripe takes a few minutes and uses a per merchant webhook, so your sales are recorded against your account only.

Add the webhook

In your Stripe dashboard, add a webhook endpoint pointing at your unique LinkJolt URL:

https://www.linkjolt.io/api/webhooks/stripe/merchant/YOUR_MERCHANT_ID

Then tick the events it should send. checkout.session.completed is required. Add invoice.payment_succeeded, customer.subscription.updated and customer.subscription.deleted so renewals are tracked, and charge.refunded so a refund reverses the commission. Your dashboard lists the events beside your webhook URL.

After you create the endpoint, Stripe shows a Signing Secret starting with whsec_. Copy it and save it in LinkJolt under Settings, on the Payment Providers tab. Until you do, LinkJolt rejects every delivery to that endpoint and no sale is recorded. Stripe also keeps separate webhook lists for live and test mode, so add the endpoint in Live mode.

Add the tracking script

Put the LinkJolt tracking script in the head of every page a visitor can land on or buy from. It stores the affiliate details from the link click and exposes them as window.linkjolt.referral.

Tracking script (add before </head>)
<script src="https://www.linkjolt.io/api/tracking.js?id=YOUR_MERCHANT_ID"></script>

Pass the referral to checkout

If your buy link points at a Stripe Payment Link, the script appends the referral to it for you. Any checkout you build in code needs one line: pass window.linkjolt?.referral || '' as clientReferenceId in stripe.redirectToCheckout, or as client_reference_id on stripe.checkout.sessions.create if your server creates the session. Without it the click is recorded but the sale is never attributed.

Prefer not to touch checkout code? Register a discount code for each affiliate on the Coupons tab of the Campaigns page, and LinkJolt matches the orders that use it.

Your exact webhook URL, the event list and your tracking snippet all live under Integrations in your LinkJolt dashboard, on the page headed Integration Hub. For a full walkthrough, see the Stripe integration guide.

Watch the setup, step by step

How to Set Up an Affiliate Program for Your Stripe SaaS (5:59)

Sunnybrief is a demo account made for this tutorial.

Watch on YouTube
Read the transcript

The result: an affiliate sale from Stripe 0:00

This is a subscription sale made through Stripe, credited to an affiliate called Jordan, with a twenty percent commission worked out for me. In this video, I'll set that up from zero.

We'll connect Stripe, create the affiliate program, give an affiliate a link and their own discount code, track the first sale, and pay it.

Why Stripe needs an affiliate layer 0:18

Stripe runs your payments and subscriptions. What it doesn't run is an affiliate program: no partner sign-ups, no tracking links, and no commission rules for the people who promote you.

So we add that layer with LinkJolt. My demo product is Sunnybrief, a nineteen dollar a month app. When someone clicks buy, its own code creates a Stripe Checkout session.

This is a brand new LinkJolt account. The quick setup list shows the whole job: a campaign, a connection to where you take payment, affiliates, and a first sale. I'll start with Stripe, so the campaign can create a Stripe discount code for every affiliate.

Connect Stripe 0:56

Open Integrations. Stripe is the first tab. Right now, sales from Stripe aren't reaching LinkJolt.

Click Set up with Stripe. You approve LinkJolt once, on Stripe's own site.

Stripe shows its approval screen. Choose the Stripe account you sell from, and connect. That's the whole setup: there's no webhook to create, and no secret to paste.

How your customers pay on Stripe 1:20

Back in LinkJolt, it says Done. Sales, renewals and refunds now reach LinkJolt automatically, and the same connection creates your discount codes in Stripe.

Then one question: how do your customers pay? Sunnybrief's own code creates the Stripe Checkout session, so I pick Checkout from my code.

There are two parts. First, add the tracking script to the head of your site. Then pass the referral when you create the session: the browser sends window.linkjolt.referral with your checkout request, and your server sets it as the client_reference_id.

If you sell through Stripe Payment Links, the pricing table or the buy button, pick that option instead: the script alone adds the affiliate to them. And if you can't change your site at all, pick discount codes only.

I'll copy the script into the head of my site, and add that one field where my server creates the session.

Create the campaign 2:16

Now the campaign: the deal every affiliate gets. Go to Campaigns, then New campaign.

The name is just for you. The description is for affiliates: it's what they read when deciding to join. And the page to promote is where their link sends people. Mine is the Sunnybrief home page.

The commission is twenty percent of each sale. I'll add my price, nineteen dollars, so affiliates can see what a referral is worth. It's for display only, and it doesn't change your prices in Stripe.

Sunnybrief is a subscription, so I'll switch on recurring commissions. Renewals pay twenty percent too, and I'll stop after twelve months. Recurring commissions are on the Professional plan and above.

So every renewal Stripe charges is credited to the affiliate who brought that customer.

Down here: a coupon code for every affiliate. Because Stripe is connected, each affiliate gets their own code, created in your Stripe. Customers save ten percent on their first payment, and the code is named after the affiliate.

By default, you approve each affiliate who applies to join. Click Create campaign.

Give an affiliate a link and a discount code 3:25

The campaign is live. There are three ways affiliates get in: Discovery, where affiliates browsing LinkJolt can find you; a join link for your website; and personal invitations.

I'll invite Jordan, who writes a newsletter for designers. Add their name and email, and send. Jordan gets an email naming the campaign and the commission, with a link to join.

This is what Jordan sees: the deal, in your name, and one step to join.

Jordan is approved on the campaign straight away, and gets two things: a tracking link to share, and their own discount code, JORDAN10, which LinkJolt created in my Stripe account.

Track the first sale 4:03

A few days later, one of Jordan's readers clicks their link and lands on Sunnybrief. LinkJolt records the click, and remembers the referral for thirty days.

When they click buy, the site sends Jordan's reference with the checkout request, and the server puts it on the Checkout session.

The customer pays on Stripe's checkout, as usual. Stripe tells LinkJolt about the payment, with Jordan's reference attached.

Back in LinkJolt, there's the new sale: nineteen dollars, and Jordan's commission of three dollars eighty, waiting for my approval.

You can try all of this in Stripe's test mode first. Test payments are recorded as test sales, kept apart from your real commissions.

Refunds are handled too. If you refund the customer in Stripe, the commission is reduced or removed, and any payout still waiting for it is cancelled.

Approve and pay the commission 4:57

Nothing is paid until you approve it. Open Commissions, check the sale, and approve it.

Then go to Payouts. Each affiliate chooses how they're paid. Jordan picked PayPal, so LinkJolt shows their PayPal address and what you owe. Send it in PayPal, then click Mark as paid. Or export a CSV for PayPal or Wise.

Affiliates who connect Stripe can be paid automatically: with Stripe payouts, your saved card funds the payout and Stripe sends each affiliate their share, in the US, the UK, the European Economic Area, Canada and Switzerland.

Recap 5:34

That's the whole setup. Stripe is connected, there's a campaign with recurring commissions, an affiliate with a link and a code, a tracked sale, and a commission ready to pay.

LinkJolt charges zero percent transaction fees, and plans start at nineteen ninety-nine a month. There's a seven-day free trial; a card is required. The link is in the description.

Start your affiliate program

Launch in minutes with 0% platform fees. 7-day free trial, cancel anytime.