Marketing Strategy & OperationsSetup guide3 min readUpdated September 2026

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:

  1. A visitor clicks an affiliate link containing a referral code or ID.
  2. Your site stores that referral in a first-party cookie or local storage.
  3. When the visitor signs up or starts checkout, you read the referral and attach it to the record.
  4. Stripe processes the payment, and your system receives webhook events.
  5. 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.

  1. Click a link, sign up, and pay with a test card. Confirm the affiliate is credited.
  2. Trigger a renewal in a test clock and confirm the recurring commission is created.
  3. Refund the payment and confirm the commission is reversed.
  4. Sign up on a different browser after clicking, to see how much attribution you lose.
  5. Use a coupon code that belongs to an affiliate, if you support codes, and confirm it credits correctly.
  6. 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.

Executive Capability Standard

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)

1. Learn:Learn how your customers move from click to payment, including which device and which Stripe checkout flow they use.
2. Do Manually:Record affiliate IDs in a sheet from a referral field on signup, and match to Stripe payments at month-end.
3. Delegate:Have a developer wire referral capture and webhook handling, and finance own monthly reconciliation and payouts.
4. Automate:Connect an affiliate tool to your Stripe account so referrals, renewals, and refunds update commissions automatically.
5. Buy:Choose a Stripe-connected affiliate platform and confirm in a trial how it handles trials, plan changes, refunds, and payout methods.

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.

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