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
-
Referred visit
?via=partner
AffiliateBase captures the visit and generates a referral record.
-
Checkout handoff
referral ID
The checkout must carry the generated identifier into Stripe.
-
Paid event
$99 paid
A supported Stripe event confirms the attributed payment.
-
Commission
$19.80 due
An eligible attributed sale creates the commission record.
-
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:
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.
<script async src="https://app.affiliatebase.io/track.js" data-account-id="YOUR_ACCOUNT_ID"></script>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.
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.
<!-- 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>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.
// 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',
});Test Your Integration
Visit your site with a test affiliate link, then make a test purchase to verify tracking.
// 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 dashboardWhy 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?
Can I run a Stripe referral program with promo codes?
How do I pay affiliates in a Stripe affiliate program?
Do I need to manually configure webhooks?
Does it work with Stripe Payment Links?
How are subscription renewals tracked?
What happens when a customer upgrades or downgrades?
Is server-side tracking more reliable than client-side?
What tracking parameters does AffiliateBase support?
Related platform guides
Add an Affiliate Program to Next.js
Install affiliate tracking in Next.js, hand the generated referral ID to a server-created Stripe Checkout Session, and verify attribution.
Create an Affiliate Program with WordPress
Install AffiliateBase on WordPress, choose a supported Stripe checkout, and verify referral attribution without assuming WooCommerce or plugin compatibility.
Create an Affiliate Program with Webflow
Add affiliate tracking to a published Webflow site, pair it with a supported Stripe checkout, and verify referral attribution before launch.
Ready to Launch Your Stripe Affiliate Program?
Connect Stripe, create your first campaign, and verify a referred payment before you invite partners.