Skip to main content

Stripe Affiliate Program: Setup and Tracking

Know what must work before you launch

Complete guide to tracking affiliate conversions with Stripe subscriptions, one-time payments, and recurring revenue

Best fit
Teams evaluating AffiliateBase for a Stripe affiliate workflow.
Checkout handoff
The checkout path must receive the generated AffiliateBase referral ID.
Proof required
Complete one referred checkout and confirm the attributed sale and commission.

Follow the attribution evidence

Illustrative scenario · fictional values

  1. Referred visit

    ?via=partner

    AffiliateBase captures the visit and generates a referral record.

  2. Checkout handoff

    referral ID

    The checkout must carry the generated identifier into Stripe.

  3. Paid event

    $99 paid

    A supported Stripe event confirms the attributed payment.

  4. Commission

    $19.80 due

    An eligible attributed sale creates the commission record.

  5. Payout prep

    Payout ready

    Review the commission and prepare the next step with your payout provider.

Create an affiliate program for your own Stripe business with AffiliateBase: connect payments to referred customers, apply commission rules, and give partners their own referral links. This guide is for merchants running a program; to refer businesses to Stripe itself, see Stripe partnerships.

Start with a Stripe account, an AffiliateBase campaign, and access to the page where visitors begin checkout. For Payment Links, keep the link and tracking script on the same page. For backend-created Checkout Sessions, your developer must send the generated referral ID from the browser to Stripe.

A tracked click does not prove a payment is attributed. Follow the Stripe checkout integration instructions, then confirm a referral, paid event, and commission using the verification checklist. For commission and payout requirements, start with the SaaS affiliate program launch guide.

Follow these steps to set up Stripe affiliate tracking:

1

Add the Tracking Script

Add the AffiliateBase tracking script to your website. This captures the referral ID when visitors arrive via affiliate links. Use the pinned jsDelivr tracking URL for the latest published AffiliateBase release.
html
<script async src="https://app.affiliatebase.io/track.js" data-account-id="YOUR_ACCOUNT_ID"></script>
2

Connect Your Stripe Account

Pass the generated referral ID as client_reference_id to Stripe for accurate conversion tracking. Do not use the public ?via token. In your AffiliateBase dashboard, go to **Setup step 1 (Connect Stripe)** and connect your Stripe account. This enables automatic conversion tracking via Stripe webhooks.
3

Stripe Payment Links (Easiest)

If you use Stripe Payment Links or Buy Buttons, add the tracking script on the same page so AffiliateBase can pass the generated referral ID to Stripe.
html
<!-- Keep Stripe checkout elements on the same page as the AffiliateBase script. -->
<a href="https://buy.stripe.com/xxxxx">Buy now</a>

<stripe-pricing-table
  pricing-table-id="prctbl_xxx"
  publishable-key="pk_live_xxx"
></stripe-pricing-table>

<!-- For custom or redirected Stripe-hosted links, opt in explicitly. -->
<a data-affiliatebase href="https://link.payment/xxxxx">Buy now</a>
4

Stripe Checkout (Custom Integration)

If you use Stripe Checkout programmatically, submit the generated referral ID from the browser and pass it as client_reference_id.
javascript
// Server-side: use referral_id submitted from the browser checkout request.
// The browser value should be window.AffiliateBase.referral, not the public ?via token.
const referralId = req.body.referral_id || '';

const session = await stripe.checkout.sessions.create({
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
  ...(referralId && { client_reference_id: referralId }),
  ...(referralId && {
    metadata: { affiliatebase_referral_id: referralId },
    subscription_data: {
      metadata: { affiliatebase_referral_id: referralId },
    },
  }),
  line_items: [
    { price: 'price_xxx', quantity: 1 },
  ],
  mode: 'subscription',
});
5

Test Your Integration

Visit your site with a test affiliate link, then make a test purchase to verify tracking.
javascript
// Visit your site with a test affiliate link:
// Use the exact test affiliate link generated by AffiliateBase setup.

// Check the console to verify the referral ID is captured:
console.log(window.AffiliateBase?.referral); // Should show a generated referral ID

// Make a test purchase and verify in your AffiliateBase dashboard

Why Use AffiliateBase for Stripe Tracking?

Use one workflow to connect checkout attribution, recurring commissions, and payout preparation.

Connect Stripe

Authorize the Stripe connection in setup and confirm that payment events are arriving.

Server-Side Tracking

Process Stripe payment events on the server. Link attribution still depends on referral capture and a successful checkout handoff.

Subscription Lifecycle Tracking

Review attributed subscription payments and recurring commissions. Commission rules and recurring caps determine whether each payment earns a commission.

Real-Time Processing

Review processed Stripe events alongside the resulting sale and commission records.

Payment Links Support

Works seamlessly with Stripe Payment Links, Buy Buttons, and Pricing Tables.

One-Time and Recurring Payments

Attribute supported Stripe payment and invoice events to referrals. Test your actual billing flow, including renewals and refunds.

Frequently Asked Questions

How does Stripe affiliate tracking work?
AffiliateBase receives payment events through your active Stripe connection. It matches supported payments to a referral, coupon, or known referred customer. A received webhook alone does not prove attribution; verify the resulting sale and commission records.
Do I need to manually configure webhooks?
No! When you connect your Stripe account via Stripe Connect, AffiliateBase automatically sets up the necessary webhooks for you.
Does it work with Stripe Payment Links?
Yes. Keep the Stripe Payment Link on the same page as the AffiliateBase tracking script and the generated referral ID is passed to Stripe via client_reference_id.
How are subscription renewals tracked?
AffiliateBase uses Stripe payment events and the referred customer association to track eligible subscription renewals. Your campaign commission rules and recurring caps determine whether a renewal earns a commission. Verify the payment, sale, and commission records for your billing flow.
What happens when a customer upgrades or downgrades?
Review the resulting Stripe payment and attributed sale. Percentage commissions use the sale net amount, while fixed commissions use the campaign amount; recurring caps may prevent a new commission. A subscription change by itself does not prove that a commission was created.
Is server-side tracking more reliable than client-side?
Stripe webhooks deliver payment events server-side, but affiliate link attribution still needs the browser referral and checkout handoff. Blocked scripts, missing referral IDs, or failed webhooks can prevent attribution; test the full path.
What tracking parameters does AffiliateBase support?
AffiliateBase automatically detects ?via= URL parameters by default. You can add custom token keys with data-affiliatebase-params.

Related Platform Guides

Ready to Set Up Stripe Affiliate Tracking?

Get started with AffiliateBase today and start tracking Stripe conversions accurately with server-side webhooks.