Skip to main content

Stripe Affiliate and Referral Program Software

What a Stripe affiliate program needs

Connect Stripe, give each partner a referral link or promo code, and prove the first attributed sale before you invite affiliates.

Best fit
Businesses taking payments in their own Stripe account through Payment Links, Buy Buttons, Pricing Tables, Checkout Sessions, or Stripe promo codes.
Checkout handoff
Referral links pass the generated referral ID to Stripe as client_reference_id or metadata. Promo-code-only programs need no website script.
Proof required
Complete one referred test payment and confirm the attributed sale and commission in AffiliateBase.

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.

AffiliateBase is affiliate and referral program software for businesses that take payments through Stripe. Connect your Stripe account, create a campaign with your commission rules, and give each affiliate, partner, or customer who joins a referral link or a Stripe promo code. When a referred customer pays, AffiliateBase attributes the Stripe payment and creates the commission, including on eligible subscription renewals. Refunds and disputes adjust it. This guide is for merchants running their own program; to refer businesses to Stripe itself, see Stripe partnerships.

Choose the attribution path that matches your checkout. For Payment Links, Buy Buttons, and Pricing Tables, keep the Stripe element and the tracking script on the same page. For backend-created Checkout Sessions, your developer sends the generated referral ID from the browser to Stripe. For a code-only program, assign Stripe promo codes to affiliates; no script is needed.

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. When commissions are due, pay affiliates with PayPal and Wise exports, or by Stripe transfer from your own Stripe balance once Stripe payouts are set up. For commission rules and launch planning, start with the SaaS affiliate program launch guide.

Follow these steps to set up your Stripe affiliate program:

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 Run Your Stripe Affiliate Program on AffiliateBase?

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

The tracking script sets the referral on Stripe Payment Links, Buy Buttons, and Pricing Tables on the same page.

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.
Can I run a Stripe referral program with promo codes?
Yes. Generate a unique Stripe promotion code for each affiliate in a campaign, or assign an existing Stripe code to one affiliate. The Stripe discount controls what the customer gets; the campaign commission controls what the referrer earns. A code-only program needs no website script.
How do I pay affiliates in a Stripe affiliate program?
AffiliateBase prepares PayPal and Wise payout exports, and you send the money in those tools. If you set up Stripe payouts, AffiliateBase can pay affiliates who finish Stripe sign-up by Stripe transfer from your own Stripe balance.
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 Launch Your Stripe Affiliate Program?

Connect Stripe, create your first campaign, and verify a referred payment before you invite partners.