partli.Sign inStart free trial
GUIDE · STRIPE · UPDATED OCTOBER 2026

How to run an affiliate program on Stripe.

Stripe takes the payments, but it won't tell you which affiliate brought the customer, what they're owed on each renewal, or what to claw back after a refund. This guide covers the four pieces you need, the exact Stripe events involved, and where homemade setups usually break.

SHORT ANSWER
Stripe has no affiliate feature, so you need four things on top of it: capture the referral click, pass it into Checkout as client_reference_id, credit commissions from checkout.session.completed and invoice.paid (clawing back on refunds and disputes), and pay partners after a holding period. You can build it, or connect an affiliate tool to Stripe in a few minutes.

The four pieces

PIECEWHAT IT DOESSTRIPE FEATURE INVOLVED
1. CaptureRemember which partner sent the visitor, across pages and daysNone: your site or an affiliate script
2. PassTie the checkout to that referralclient_reference_id or metadata; promotion codes
3. CreditTurn payments into commissions, renewals included, and reverse them on refundsWebhooks: checkout.session.completed, invoice.paid, charge.refunded, charge.dispute.created
4. PaySend partners what they've earned, once it's safeConnect transfers (or PayPal / Wise outside Stripe)

1. Capture the referral

Partners share a link such as yoursite.com/?via=jane. When a visitor lands, record the click server-side and keep its id in a first-party cookie, so the sale is still attributed when they come back days later to buy. Thirty to ninety days is the usual window.

Two details catch people out. Ad blockers and privacy browsers drop third-party scripts, so serve the click endpoint from a domain you control. And in the UK and EU, setting that cookie needs consent: without it you can still keep the id in memory for the current visit. Partli's snippet has a cookieless mode for exactly this.

2. Pass it into Stripe Checkout

If you create Checkout Sessions on your server, attach the click id:

const session = await stripe.checkout.sessions.create({
  mode: "subscription",
  line_items: [{ price: "price_pro_monthly", quantity: 1 }],
  client_reference_id: req.cookies.affiliate_click_id, // the referral
  subscription_data: {
    metadata: { affiliate_click_id: req.cookies.affiliate_click_id },
  },
  success_url: "https://yoursite.com/welcome",
});

Put it in subscription_data.metadata as well. Renewal invoices don't carry the session's client_reference_id, so without this you have to look the original session up on every renewal.

With Payment Links, Buy Buttons or Pricing Tables you can't run server code, but Stripe accepts ?client_reference_id= on Payment Link URLs and a client-reference-id attribute on the embeds. Partli's partli.js fills these in automatically.

Promotion codes cover referrals without a click: a partner reads their code on a podcast and the listener types it at checkout. Give each partner their own Stripe promotion code and treat a sale with that code as theirs.

3. Credit commissions from Stripe events

EVENTWHAT TO DO
checkout.session.completedFirst payment. Look up the click, create the commission, and link the Stripe customer to the partner for future renewals.
invoice.paidRenewal. If the customer belongs to a partner and the reward is recurring (say 12 months) or lifetime, create another commission.
charge.refundedFull refund: reverse the matching commission if it hasn't been paid. Partial refund: flag it for a human.
charge.dispute.createdChargeback: the money has already left your account, so reverse the commission now.

Three decisions to make up front, because changing them later is painful:

  • Commission base. Use the amount actually paid after discounts, before tax. Commissioning on list price overpays partners whose customers used a coupon.
  • Holding period. Keep commissions pending for at least your refund window (30 days is common) before they can be paid. Then refunds cost you nothing.
  • Currency. If you charge in several currencies, keep commissions in the currency of the sale and never add USD to GBP in one total.

4. Pay your partners

Stripe Connect lets each partner onboard a connected account, and you then send transfers from your balance. It's tidy for partners in Connect-supported countries. Plenty of affiliates prefer PayPal or Wise, and some countries aren't supported at all, so most programs end up with more than one rail.

Before the first payout, collect tax forms (W-9 from US partners, W-8BEN from everyone else if you're a US company), and set a minimum payout so you don't send $3 transfers.

Build it yourself, or use a tool?

A basic version (one reward, Checkout Sessions only, manual payouts) takes a few hundred lines and a few webhook handlers. The cost is in the edge cases that arrive later: renewals that lost their metadata, refunds after payout, partners asking where their money is, tax forms, fraud such as people referring themselves, and a partner portal so affiliates can see their own stats. That's the point where most teams switch to an affiliate tool.

Doing it with Partli

  1. Add the snippet to your site's <head>: <script defer src="https://partli.app/partli.js" data-partli></script>. It captures ?via= links and fills in client_reference_id on Payment Links, Buy Buttons, Pricing Tables and Checkout redirects.
  2. Connect Stripe. This is an OAuth sign-in, with no keys to copy and no new Stripe account. Partli then receives the four events above from your account.
  3. Create a program and its reward, for example 20% recurring for 12 months with a 30-day holding period.
  4. Choose how to pay: Stripe Connect (Partli sends it, 1% plus Stripe at cost), or your own PayPal or Wise (no Partli fee).

Full refunds and disputes are clawed back automatically, and partial refunds are flagged for review. You can run all of it from Claude or ChatGPT; see running an affiliate program from an AI agent. Still choosing a tool? Our guide to affiliate software for SaaS compares the Stripe-friendly options.

FAQ

Does Stripe have a built-in affiliate program feature?

No. Stripe handles payments, subscriptions, promotion codes and (through Connect) payouts to other people, but it does not track which affiliate referred a customer or calculate commissions. You add that with your own code or an affiliate tool that reads your Stripe events.

How do I track which affiliate referred a Stripe customer?

Store the referral click when the visitor lands (usually in a first-party cookie), then pass its id to Stripe Checkout as client_reference_id or in metadata. When checkout.session.completed fires, look the id up and credit the partner. Promotion codes tied to each partner cover referrals that happen without a link, such as podcasts.

How are recurring commissions calculated on Stripe subscriptions?

Listen for invoice.paid. Each paid renewal invoice for a referred customer creates a new commission, until the reward's duration ends (for example 12 months) or forever for lifetime rewards. Use the invoice's amount paid after discounts and before tax as the commission base.

How do I pay affiliates through Stripe?

With Stripe Connect, each affiliate onboards a connected account and you send transfers from your platform balance. Many programs pay through PayPal or Wise instead, because affiliates in some countries can't use Stripe Connect. Partli supports both: payouts via Stripe Connect, or through your own connected PayPal or Wise account.

Run your partner program from your agent.

Unlimited partners and tracked sales on every plan. Partners keep 100% of every commission.

Start 7-day free trial

No charge for 7 days · Cancel anytime