How to Set Up Affiliate Tracking on Stripe
To track affiliates on Stripe, capture the referral when a visitor lands, keep it through sign-up, attach it to the Stripe customer or Checkout Session, and use Stripe webhooks to record each payment against the right affiliate. A tool built for Stripe affiliate programs does this for you, or you can build it yourself.
The tricky parts aren't the first sale. They're recurring payments, refunds, and customers who sign up days after clicking. Plan for those before you launch, and test everything in Stripe's test mode.
Vendors Covered in this Article
Disclosure: We may earn a commission if you buy through some links on this page. It doesn't change what we recommend.
How does affiliate tracking work with Stripe?
The flow has five links, and each one can break:
- A visitor clicks an affiliate link containing a referral code or ID.
- Your site stores that referral in a first-party cookie or local storage.
- When the visitor signs up or starts checkout, you read the referral and attach it to the record.
- Stripe processes the payment, and your system receives webhook events.
- Your system credits the affiliate, applies the commission rules, and later pays out.
The usual failure is between steps 2 and 3, when a visitor clicks on one device, signs up on another, or clears cookies. Decide how much of that leakage you'll accept, and consider capturing the referral again on the signup form or asking a "how did you hear about us" question.
How do you pass the referral into Stripe?
You have a few options for storing the referral against the sale:
- Set the referral ID as the client reference ID when you create a Checkout Session, so it appears on the session.
- Add it as metadata on the Checkout Session, the customer, or the subscription so it's available on later events.
- If you use payment links, append the reference and confirm how your setup passes it through.
Storing it on the customer or subscription is important for subscriptions, because later invoices will need to be credited to the same affiliate. Keep your own database record linking each Stripe customer ID to an affiliate ID, in case metadata is missing or changed.
Which Stripe webhooks should you listen for?
For a subscription product, a typical set is:
- checkout.session.completed, for the first successful purchase.
- invoice.paid, for each recurring payment, so recurring commissions are credited from real payments and not from your billing schedule.
- charge.refunded or refund events, to cancel or reverse commissions.
- charge.dispute.created, to freeze commissions on disputed payments.
- customer.subscription.deleted or updated, to end recurring commission and handle plan changes.
Verify webhook signatures, make handlers idempotent so a retried event doesn't credit a commission twice, and log every event you process. Check Stripe's current documentation for the exact event names and payloads before you build.
Build it yourself or use a dedicated tool?
Build if you have engineering time, a simple program, and unusual rules. Expect to build the referral capture script, affiliate dashboard, commission ledger, refund handling, payout reports, and fraud checks. That's more work than it sounds.
Use a tool like Rewardful if you want Stripe-connected tracking, recurring commissions, and affiliate dashboards without building the plumbing. In a demo, confirm how it handles your specific setup: Checkout versus payment links, trials, plan changes, refunds, coupon codes, and how commissions are paid out.
Either way, decide first how commissions will be paid and what you'll pay on. See affiliate program terms for the rules to publish.
How to test before you launch
Use Stripe's test mode and a few test affiliate links.
- Click a link, sign up, and pay with a test card. Confirm the affiliate is credited.
- Trigger a renewal in a test clock and confirm the recurring commission is created.
- Refund the payment and confirm the commission is reversed.
- Sign up on a different browser after clicking, to see how much attribution you lose.
- Use a coupon code that belongs to an affiliate, if you support codes, and confirm it credits correctly.
- Send a duplicate webhook to make sure it doesn't double-count.
After launch, reconcile monthly: total commissions owed against Stripe revenue by affiliate. Mismatches show tracking gaps early. For a view on setting the rates, see SaaS affiliate commission rates.
What Good Looks Like
Each sale and renewal on Stripe is credited to the correct affiliate, refunds and disputes reverse commissions, and monthly reconciliation matches commissions owed to Stripe revenue.
Building The Capability (5-Stage Skill Ladder)
How to Get Started
Disclosure: We may earn a commission if you buy through some links on this page. It doesn't change what we recommend.
Fits Stripe-based SaaS companies that want referral tracking and recurring commissions without building the plumbing.
Frequently Asked Questions
Can Stripe track affiliates on its own?
Not as a built-in affiliate program. Stripe processes payments and sends events, and you record which affiliate referred each customer by storing a reference or metadata. Affiliate tools or your own code handle the tracking, commissions, and payouts.
How do I credit recurring subscription payments to an affiliate?
Store the affiliate ID against the Stripe customer or subscription, then credit each paid invoice from the invoice.paid webhook. That way commission follows real payments, and you can stop it when the subscription ends or the payment is refunded.
What happens to commissions when a customer is refunded?
Reverse or cancel them. Listen for refund and dispute events, mark the related commission as reversed, and claw back any amount already paid as your terms provide. Use a refund hold period so most reversals happen before payout.
Do I need cookies for affiliate tracking on Stripe?
Usually you need some way to remember the referral between the click and the purchase, most often a first-party cookie or local storage. Also capture the referral in your signup flow where possible, and follow applicable consent rules for cookies.
About the numbers
This guide doesn't quote a sourced benchmark. Figures in it are estimates or general guidance, so check them against your own numbers.
Related Guides
Affiliate Program Terms: Clauses to Include
The clauses to include in affiliate program terms: commissions, attribution, prohibited practices, disclosure, refund holds, taxes and termination.
SaaS Affiliate Commission Rates: How to Set Yours
How to set a SaaS affiliate commission from your margins, CAC and payback period, compare recurring, one-time and tiered structures, and research competitors.
Rewardful or PartnerStack: Which Fits Your Stripe Billing?
How Rewardful and PartnerStack each read your Stripe subscription events, and a simple test for which one fits a Stripe-billed SaaS company.
PartnerStack vs Impact vs Rewardful: SaaS Affiliate Guide
Compare PartnerStack, Impact.com, and Rewardful for B2B SaaS affiliate and partner management. Evaluate payouts, tracking, and Stripe attribution.
Proving a Phone Call Came From a Specific Affiliate or Creator
A worked example of setting up call tracking so a phone lead can be traced back to the specific creator or affiliate campaign that generated it, and paid on it.
How to Set Up an Evergreen Webinar Funnel
Set up an evergreen webinar funnel step by step: pick the topic, record it, schedule sessions, build the emails and offer, drive traffic and stay honest.