How to Set Up an Affiliate Program With Stripe for SaaS

Already billing through Stripe? Learn how to run an affiliate program: connect Stripe, track conversions server-side, and pay commissions through Stripe Connect.

RefCampaign Team
7 min read
Reading information
Reading time7 min
Word count1345
DifficultyMedium

You bill subscriptions through Stripe. You want partners to bring in customers and pay them only on revenue that actually clears. That is the standard affiliate use case for a SaaS.

The practical advantage: Stripe is already your revenue source of truth. Every subscription created, every invoice paid, every refund issued — all of it flows through Stripe events you already have access to. A well-designed affiliate program attaches directly to that data, with no fragile intermediate layer.

This guide covers the concrete steps: connecting Stripe, configuring a campaign, server-side conversion tracking, recurring commissions, and paying out through Stripe Connect. For the deeper architecture debate — native vs integration, webhooks vs polling — see the companion article on Stripe affiliate software: native vs integration.


1. Why Stripe makes affiliate programs more reliable for SaaS

Most affiliate platforms were built for e-commerce: one click, one transaction, one cookie. SaaS is different. A free trial can last 14 days. A conversion means an active subscription, not a one-time charge. Real revenue is spread across monthly or annual renewals.

When Stripe is your billing layer, you already have:

  • A stable identifier per customer (customer)
  • A reliable billing history (invoice.paid, invoice.payment_failed)
  • A clear cancellation signal (customer.subscription.deleted)
  • A traceable refund stream (charge.refunded)

Affiliate attribution can anchor on these events rather than on an ephemeral browser session. That is more reliable, and it is what serious partners expect: payment on real revenue, not on clicks or signups.


2. Setting up an affiliate program when you bill through Stripe

Connecting Stripe to your affiliate platform

The first step is authorizing your affiliate platform to read your Stripe events. Two approaches exist: OAuth via Stripe Connect (your Stripe account stays central, the platform gets delegated read access) or a restricted read-only API key.

With RefCampaign, the connection uses Stripe Connect OAuth. You authorize access from your Stripe dashboard; the platform listens to your invoice.paid webhooks without storing your secret keys.

Defining your campaign

An affiliate campaign in a SaaS context requires at minimum:

ParameterConcrete example
Commission typeRecurring (30% per renewal) or one-time ($50 on first paid invoice)
Attribution window30 or 60 days after click
Refund window30 days (commission held pending during this period)
Trigger conditionFirst invoice.paid with active subscription status

A 30% recurring commission is the standard in B2B SaaS. It aligns the affiliate's incentive with retention: they earn as long as the customer stays, which encourages them to bring in qualified leads rather than chasing volume.

Each affiliate receives a tracked link to your trial or pricing page (for example https://your-saas.com?ref=CODE). The code is recorded server-side on first click, associated with the visitor's email address or session identifier.

For advanced configuration options, see the Stripe affiliate tracking feature page.


3. Tracking Stripe conversions and attributing them to affiliates

A browser cookie gets cleared, expires, or gets blocked in many common scenarios: different browser between click and purchase, iOS Safari ITP, private browsing, or a 45-day gap between click and conversion. For a SaaS with a longer sales cycle, this translates to real attribution loss.

The correct approach is to capture the affiliate code server-side on first click and attach it to a durable entity: the email address at trial signup, or the customer Stripe object at account creation.

Attaching attribution before payment

The recommended flow:

  1. Visitor clicks the affiliate link → code captured in a server-side session, plus a cookie fallback
  2. Visitor signs up for the trial → code associated with the email in your database
  3. At customer creation in Stripe, the affiliate code is stored in metadata: customer.metadata.affiliate_code
  4. On the first invoice.paid, your webhook reads customer.metadata.affiliate_code and records the conversion

This chain is durable: even if the cookie disappears between step 1 and step 4, attribution is preserved through Stripe metadata.

Reading Stripe events

These are the events to listen to via your webhook endpoint (Stripe official documentation):

EventAction in the affiliate program
invoice.paidCreate a commission (status: pending)
invoice.payment_failedDo not create a commission
customer.subscription.deletedStop future recurring commissions
charge.refundedCancel the commission if within the refund window

For the first invoice.paid, verify that subscription is present in the invoice object and that billing_reason is subscription_create. Renewals have billing_reason: subscription_cycle.

Recurring commissions on renewals

On each invoice.paid with billing_reason: subscription_cycle, a new commission is generated for the original affiliate, as long as:

  • The attribution window is still active (or unlimited for commissions without a time cap)
  • The subscription has not been cancelled
  • No prior commission was voided due to a refund

For a deeper look at tracking mechanics and common failure modes, the article on affiliate tracking: how it works, what can break covers the edge cases.


4. Paying commissions through Stripe Connect

The payout flow

Stripe Connect lets you transfer funds directly from your Stripe account to an affiliate's bank account. The affiliate creates a Connect account (Express or Standard), completes KYC, and you can send payouts from your dashboard or via the API.

The standard cycle for SaaS:

  1. Commission generated on invoice.paid → status pending
  2. Refund window expires (30 days) → status due
  3. Payment cycle (NET-30 or first of the month) → status processing
  4. Stripe Connect transfer executed → status paid

If a refund arrives during the refund window: commission voided before payout.

Commission status reference

StatusCondition
Pendinginvoice.paid received, refund window not yet expired
DueRefund window expired, ready to pay out
VoidedRefund received before payout, or subscription cancelled before first invoice
PaidStripe Connect transfer executed

NET-30 and the refund window

The refund window protects your cash flow: you do not pay out a commission on a transaction that could be refunded 15 days later. Standard practice in SaaS is to match the refund window to your customer refund policy (typically 14 or 30 days), then apply NET-30 for the payment cycle.

In practice: a commission generated on January 1 is paid out no earlier than January 31 (after the 30-day refund window), at the next payment cycle.

To compare how different solutions handle this cycle, see the best affiliate software for SaaS in 2026.


5. Common mistakes

Attributing on checkout instead of on the paid invoice. An initiated Stripe checkout does not guarantee a successful payment. Always wait for invoice.paid — not checkout.session.completed.

Double-counting upgrades. When a customer moves from $49/month to $99/month, Stripe generates a proration invoice. If you do not filter billing_reason, you can create a second acquisition commission for a customer you already acquired. Check billing_reason: subscription_create for one-time commissions.

Paying out before the refund window closes. If you pay commissions immediately on invoice.paid and a refund arrives 10 days later, you have paid a commission on a reversed transaction. Always maintain a pending status during the refund window.

Relying on cookies alone. As detailed in section 3, a cookie can disappear between click and purchase in a long SaaS sales cycle. Server-side persistence through customer.metadata is not optional.

Ignoring subscription cancellations. If a customer cancels after 2 months, future recurring commissions stop. Listen to customer.subscription.deleted to mark the affiliate relationship as inactive for that customer.


Start your affiliate program

A well-configured Stripe affiliate program rests on three building blocks: reliable server-side attribution, correct reading of Stripe events (invoice.paid, charge.refunded, customer.subscription.deleted), and a NET-30 payout cycle through Stripe Connect.

RefCampaign implements all three natively — no manual webhook configuration, no custom development. Connect your Stripe account, define your campaign, and conversions are attributed automatically on every renewal.

View pricing — or contact the team to evaluate fit before committing.

Table of contents

Table of contents coming soon

Enjoyed this read?

Explore more articles on our blog to deepen your knowledge.

Back to blog
Keep learning

Weekly insights straight to your inbox