What this method tracks
What it can’t track
- Sign-ups before payment. The referral only exists once someone completes checkout. If you want a referral recorded at sign-up, you need the Session API method.
- A table that finished loading before the referral identifier was ready. Both load independently, so this needs verifying rather than assuming — see make sure the identifier arrived.
- A referral identifier Stripe rejects. Stripe only accepts letters, numbers, dashes and underscores here and silently ignores anything else. Keep affiliate codes plain — no spaces, dots or accented characters.
- 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.
- 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 code on your site
head section of your pages, and to place the pricing table where you want it.Your commission plan set up
Step 1: Build your pricing table in Stripe
Skip this if your table is already on your site.Open pricing tables in Stripe
Create the table
Set the look and the payment settings
Turn on promotion codes if your affiliates use them
Copy the embed code
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 Pricing Table 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 your pricing page. 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 anything up 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 pricing table snippet
This is the piece that does the work. It waits for the referral identifier, then adds it to your pricing table so it travels with the customer into Stripe’s checkout. Copy it from the Stripe Pricing Table guide on the Integrations page and paste it into thehead section, after the tracking script from Step 2. Order matters — the snippet needs the tracking script to have loaded first.
Make sure the identifier arrived
This step matters more for a pricing table than for a plain link, and it’s worth doing properly rather than assuming. The pricing table is loaded and drawn by Stripe’s own code, and your visitor’s referral identifier is fetched by Referly’s code. The two happen independently, so the only way to know they lined up is to check.Visit your pricing page through a referral link
your-domain.com/pricing?ref=THEIRCODE.Inspect the pricing table element
stripe-pricing-table element in your page. It should now carry a client-reference-id attribute with a value in it.Then confirm with a real test purchase
If the identifier never lands
If your test purchase shows an empty Client reference ID in Stripe, the table had already finished loading before the identifier was ready. Set the attribute yourself instead of relying on the snippet, and hold the table back until you have a value:pricing-table.js script tag on the page as well — this only replaces the table element, not the script that powers it.
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 table
Visit your pricing page through a referral link
Check the attribute is set
client-reference-id with a value.Buy a plan 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 the test pricing table embed code on your site for the live one, including the live publishable key.
Troubleshooting
The pricing table has no client-reference-id attribute
The pricing table has no client-reference-id attribute
- 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 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 the table added to the page later? If a pop-up or a tab reveals the table after the page has settled, the snippet has already stopped looking. Use the manual approach.
The attribute is there but Stripe's Client reference ID is empty
The attribute is there but Stripe's Client reference ID is empty
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