buy.stripe.com/.... You create them in the Stripe Dashboard, drop them on your site as buttons or links, and Stripe handles the rest. No backend code, which is exactly why so many people use them.
Referly tracks them by adding the referral identifier onto the end of the link before the visitor clicks it. There’s a snippet that does this for you automatically, so you never have to touch the links themselves.
What this method tracks
What it can’t track
Payment Links are less precise than the Session API method, and the gaps are worth knowing before you launch.- A link the snippet can’t see. The snippet rewrites
buy.stripe.comlinks that are on the page as ordinary links. A link built by a button’s click handler, opened inside a pop-up widget, or living in an iframe won’t be rewritten. See when the snippet won’t reach your links. - A link shared outside your site. If an affiliate posts your raw Payment Link in a newsletter or a Discord message, there’s no page for the snippet to run on and no referral is recorded. Affiliates should always share their Referly link, which points at your site.
- A referral identifier Stripe rejects. Stripe only accepts letters, numbers, dashes and underscores here, and silently drops anything else. If your affiliates’ codes contain spaces, dots or accented characters, attribution fails quietly. Keep codes plain — see referral links.
- A buyer who switches devices between clicking the referral link and paying.
- A buyer whose browser blocked the script, or who cleared their cookies in between.
- A purchase after the cookie window closed. See tracking methods.
- Sign-ups before payment. Unlike the Session API method, there’s no way to record a referral at sign-up. The referral only exists once someone reaches checkout.
- Live payments while you’re connected in test mode, and the reverse. Referly deliberately ignores the mismatched ones.
Before you start
A Stripe account you can log into as an administrator
Somewhere to paste two snippets
head section of your pages — through your site builder’s custom code area, your theme settings, or Google Tag Manager.Your commission plan set up
Step 1: Create your Payment Link in Stripe
Skip this if your links already exist.Open Payment Links in Stripe
Create the link
Turn on promotion codes if your affiliates use them
Copy the link
buy.stripe.com address and put it on your site as a normal link or button.Step 2: Install the tracking script
The tracking script records clicks and remembers which affiliate sent each visitor. Nothing works without it. Open Integrations from the left sidebar, find the Stripe Payment Links card, and select it. The guide that opens has your script already filled in with your program’s ID. Copy that snippet and paste it into thehead section of every page on your site — especially any page with a payment link on it. It looks like this:
Step 3: Connect your Stripe account
Connecting Stripe is what lets Referly hear about payments. You don’t create API keys and you don’t set up anything by hand — you authorize Referly’s app from inside Stripe.Open the connect dialog
Choose live or test
Authorize Referly in Stripe
Confirm the connection
Step 4: Add the Payment Links snippet
This is the piece that does the actual work. It watches for the referral identifier, then adds it to everybuy.stripe.com link on the page so the information travels with the customer into Stripe’s checkout.
Copy it from the Stripe Payment Links guide on the Integrations page and paste it into the head section, after the tracking script from Step 2. Order matters — the snippet needs the tracking script to have loaded first.
Check that it’s working
Open your site with a referral link, for exampleyour-domain.com?ref=THEIRCODE, using a real affiliate’s code. Hover over your payment link button, or right-click and copy the link address. It should now end with client_reference_id= followed by a value:
Adding the identifier by hand
If you’d rather not use the snippet — or your links live somewhere the snippet can’t reach — you can append the parameter yourself. This is what Stripe calls a payment link URL parameter.- If the link already has a
?in it, use&instead of?to add the parameter. - Only add the parameter when
window.affiliateIdactually has a value. Sending it empty is worse than not sending it.
When the snippet won’t reach your links
The snippet finds links that are on the page as ordinary links when it runs. These situations need the manual approach above:- Buttons that redirect with code rather than being a real link. Read
window.affiliateIdinside your click handler and build the URL there. - Links added to the page after it loads — by a pop-up, an accordion, a modal, or a single-page app moving between views. The snippet stops looking a few seconds after the page loads.
- Links inside an iframe or an embedded widget. Code on your page can’t reach inside those.
- Links in emails or PDFs. There’s no page running, so nothing can be added. Send affiliates to a page on your site instead.
Step 5: Test the whole flow
Test before you send a single affiliate link out, with your Stripe connection showing the yellow Test Mode badge.Switch Stripe to a sandbox and make a test link
Visit your site through a referral link
your-domain.com?ref=THEIRCODE.Check the link was rewritten
client_reference_id= and a value. If it doesn’t, the problem is on your page, not in Stripe or Referly.Buy something with a test card
4242 4242 4242 4242, any future expiry, and any three-digit security code. The full list is in Stripe’s testing guide.Confirm it in Stripe
Confirm it in Referly
Go live
- On the Integrations page, open the Stripe panel and select Disconnect.
- Select Connect Stripe Account and authorize your live account.
- Confirm the badge is green and reads Connected.
- Swap your test payment links on the site for the live ones.
Troubleshooting
The link isn't getting the identifier added
The link isn't getting the identifier added
- Is the tracking script loading? Open your browser’s developer console and type
window.affiliateId. If it’s empty, go back to Step 2 — the tracking script isn’t running, or you didn’t arrive through a referral link. - Is jQuery loaded? The console shows an error mentioning jQuery if it’s missing. The snippet does nothing without it.
- Is the snippet after the tracking script? If the order is reversed, the snippet runs too early.
- Is your link a real link? If your button redirects using code, the snippet can’t see it. Use the manual approach.
The link has the identifier but the sale isn't attributed
The link has the identifier but the sale isn't attributed
Nothing appears in Referly at all
Nothing appears in Referly at all
The referral appeared but there's no reward
The referral appeared but there's no reward
The wrong affiliate got the sale
The wrong affiliate got the sale
Renewals aren't paying commission
Renewals aren't paying commission
The sale showed up late
The sale showed up late