How to run an affiliate program on Stripe
Stripe takes the payments but does not track affiliates. To run your own affiliate program on Stripe, add Anderro's snippet to your site, put the visitor ID on the Checkout Session, Payment Link or pricing table, and add one Stripe webhook. Payments, renewals, refunds and disputes are then credited to the right affiliate.
Stripe steps last checked December 4, 2026.
Stripe at a glance
| Snippet | <head> of every page |
|---|---|
| Secret key | Your server's environment variables (only for sign-ups) |
| Payments | Checkout, Payment Links, pricing tables, Buy Buttons, renewals |
| Plan needed | Any Stripe account; US dollar payments |
Set up in 6 steps
1. Create your program on Anderro
Sign up, add your product and choose what affiliates earn. Anderro then shows your tracking snippet with your public key filled in. It also gives you a secret key for your server.
The public key is safe in browser code. The secret key is not: keep it in your platform's secrets as ANDERRO_SECRET_KEY, never in the page or the chat.
2. Add the snippet to every page
Paste it inside <head> on every page, or ask your app builder's AI to. Platform steps: Lovable, Bolt, Replit, Next.js, Framer, Webflow.
By default the snippet waits for the visitor's consent before it sets its cookie. Call window.anderro.optIn() when they accept cookies. Your setup screen in Anderro tells you if your program is set to track without waiting.
<script src="https://track.anderro.com/a.js" data-key="YOUR_PUBLIC_KEY"></script>
3. Add the Stripe webhook
In Anderro, open your product, choose Integrations, then Stripe, and copy your webhook URL. In Stripe, open Developers, then Webhooks, add an endpoint with that URL and select the seven events Anderro lists. Paste the endpoint's signing secret back into Anderro.
Stripe now pushes payments to Anderro. Anderro keeps no access to your Stripe account, and anything Stripe did not sign is refused.
4. Pass the visitor ID with each checkout
Checkout Sessions (your server creates them): set client_reference_id and metadata.anderro_vid. For one-off payments, also set it in payment_intent_data.metadata.
Payment Links: add ?client_reference_id= and the visitor ID to the link, or use the click script in the Framer guide, which does it for every link.
Pricing tables and Buy Buttons: both take a client-reference-id attribute. Set it when you render the element, as below.
Stripe accepts letters, digits, dashes and underscores up to 200 characters here and silently drops anything else. Anderro's visitor IDs fit.
// where your server creates the Stripe Checkout Session
const session = await stripe.checkout.sessions.create({
// ...your existing options
...(visitorId && {
client_reference_id: visitorId,
metadata: { anderro_vid: visitorId },
}),
});
<!-- Stripe pricing table or Buy Button: render it with the visitor ID -->
<div id="pricing"></div>
<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
<script>
window.addEventListener("load", function () {
var table = document.createElement("stripe-pricing-table");
table.setAttribute("pricing-table-id", "prctbl_...");
table.setAttribute("publishable-key", "pk_live_...");
var vid = window.anderro && window.anderro.getVisitorId && window.anderro.getVisitorId();
if (vid) table.setAttribute("client-reference-id", vid);
document.getElementById("pricing").appendChild(table);
});
</script>
5. Record sign-ups (optional)
If people create an account before they pay, send the sign-up too, so affiliates see who signed up and you can pay per sign-up if you want to. A sale is credited without it.
// on your server, after the account is created
await fetch("https://track.anderro.com/events", {
method: "POST",
headers: {
"content-type": "application/json",
"x-api-key": process.env.ANDERRO_SECRET_KEY,
},
body: JSON.stringify({
type: "signup",
customerEmail: email,
visitorId, // sent up by the browser from window.anderro?.getVisitorId()
}),
});
6. Publish and test
Deploy or publish your site.
Then open your site through your own test referral link from Anderro, sign up and buy. The click, the sign-up and the sale show on your Anderro dashboard. Stripe's test mode works too: test payments never earn a commission.
How a sale is tied to an affiliate
The snippet remembers which affiliate sent a visitor and gives that visitor an ID. Your checkout passes the ID to Stripe, Stripe sends the sale to Anderro, and the affiliate who sent the customer is credited. Renewals need no extra code: they are matched to the customer from their first payment.
A customer who already bought through one affiliate stays with that affiliate, and an affiliate buying through their own link earns nothing unless you allow it.
What to know on Stripe
- Renewals need no extra code: they are matched to the customer from their first payment, and earn a commission if your program pays on every payment.
- Subscriptions created through Stripe's API without a Checkout Session need your own code to report the sign-up to Anderro.
- If several of your products share one Stripe account, each payment must name its product. Report those from your own code, or use one Stripe account per product.
- Anderro does not pay affiliates through Stripe. You pay them yourself and mark the payout paid in Anderro.
- US dollars only. A payment in another currency is not recorded, and Anderro's Integrations page tells you when one arrives.
- Commissions wait out a hold you choose (7 to 90 days), so a refund inside the hold never costs you a commission.
If something does not show up
Stripe shows failed webhook deliveries
The signing secret in Anderro does not match the endpoint. Copy it again from the endpoint in Stripe and paste it into Anderro.
Pricing table sales are not credited
The client-reference-id attribute must be set when the table is rendered, before the buyer clicks. Stripe drops values with other characters.
My test click does not show up
The snippet waits for consent: accept cookies on your site, and check that your cookie banner calls window.anderro.optIn(). If your site sets a Content Security Policy, allow https://track.anderro.com in script-src and connect-src.
A sale shows up, but no affiliate is credited
The visitor ID did not reach the checkout. Open the payment in your billing dashboard and check it carries the ID, and buy in the same browser you opened the referral link in.
Questions
Does Stripe have an affiliate program?
Stripe runs a partner program for agencies, technology partners and investors (co-marketing, co-selling, referrals and integrations). It is not affiliate tracking for your own customers. To pay people who send you customers, you add affiliate tracking on top of Stripe, which is what this guide does. Stripe's App Marketplace lists apps in an affiliate and referrals category.
Does Anderro need access to my Stripe account?
No. You add a webhook in your own Stripe account and Stripe pushes the events to Anderro. Anderro never holds a key to your account.
What happens on a refund or a dispute?
A full or partial refund reduces the commission by the amount refunded. A dispute claws the whole commission back, and a dispute you win restores it.
Does Anderro pay my affiliates?
No. Anderro tracks clicks, sign-ups and sales and works out what each affiliate earned. You pay affiliates yourself and mark the payout paid in Anderro.
Do my affiliates need an account on this platform?
No. They join your program on Anderro and get their link there. Their link is your site's address ending in ?ref= and their code.
Sources
Stripe's menus and plans change; these are the pages we checked.
- Stripe docs: Checkout Session client_reference_id, checked December 4, 2026
- Stripe docs: Payment Links URL parameters, checked December 4, 2026
- Stripe docs: Embeddable pricing table, checked December 4, 2026
- Stripe docs: Buy Button, checked December 4, 2026
- Stripe: Become a partner, checked December 4, 2026
- Stripe App Marketplace: Affiliate and referrals, checked December 4, 2026
Stripe is a trademark of its owner. Anderro is not affiliated with or endorsed by them.