Stripe is the leading payment processor for SaaS and membership businesses, handling billions in transactions annually. If you're using Stripe for payments and want to track affiliate conversions accurately, AffiliateBase provides seamless integration through Stripe Connect.
This comprehensive guide will walk you through everything you need to know about setting up affiliate tracking with Stripe, from adding the tracking script to automatic conversion tracking through Stripe webhooks.
Whether you're processing one-time payments, subscriptions, or both, AffiliateBase's Stripe integration ensures every conversion is tracked accurately.
Follow these steps to set up Stripe affiliate tracking:
Add the Tracking Script
<script>(function(w,r){w._abq=w._abq||[];w[r]=w[r]||function(){(w[r].q=w[r].q||[]).push(arguments)}})(window,'affiliatebase');</script>
<script async src="https://cdn.jsdelivr.net/npm/affiliatebase-tracking@1/src/index.js" data-org-id='YOUR_ORG_ID'></script>
Connect Your Stripe Account
Stripe Payment Links (Easiest)
<!-- Add to your site alongside the tracking script -->
<script>
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function() {
const referralId = window.affiliatebase_referral || '';
if (!referralId) return;
// Update Stripe Payment Links
document.querySelectorAll('a[href^="https://buy.stripe.com/"]').forEach(link => {
const url = new URL(link.href);
if (!url.searchParams.has('client_reference_id')) {
url.searchParams.set('client_reference_id', referralId);
link.href = url.toString();
}
});
// Update Stripe Pricing Tables
document.querySelectorAll('stripe-pricing-table').forEach(table => {
table.setAttribute('client-reference-id', referralId);
});
// Update Stripe Buy Buttons
document.querySelectorAll('stripe-buy-button').forEach(button => {
button.setAttribute('client-reference-id', referralId);
});
}, 1500);
});
</script>
Stripe Checkout (Custom Integration)
// Get referral ID from tracking script
const referralId = window.affiliatebase_referral || '';
const session = await stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
customer_creation: 'always',
...(referralId && { client_reference_id: referralId }),
line_items: [
{ price: 'price_xxx', quantity: 1 },
],
mode: 'subscription',
});
Test Your Integration
// Visit your site with a test affiliate link:
// https://yoursite.com?via=test123
// Check the console to verify the referral ID is captured:
console.log(window.affiliatebase_referral); // Should show "test123"
// Make a test purchase and verify in your AffiliateBase dashboard
Why Use AffiliateBase for Stripe Tracking?
AffiliateBase provides the most reliable and comprehensive Stripe affiliate tracking solution for SaaS and membership businesses.
One-Click Stripe Connect
Connect your Stripe account in seconds with Stripe Connect. No manual webhook configuration required.
Server-Side Tracking
Track conversions via Stripe webhooks on the server, ensuring accuracy even when ad blockers are present.
Subscription Lifecycle Tracking
Automatically track subscription renewals, upgrades, and downgrades. Get accurate attribution for recurring revenue.
Real-Time Processing
Process Stripe webhooks in real-time for instant conversion tracking and commission attribution.
Payment Links Support
Works seamlessly with Stripe Payment Links, Buy Buttons, and Pricing Tables.
Handles All Payment Types
Track one-time payments, subscriptions, setup fees, and usage-based billing.
Frequently Asked Questions
How does Stripe affiliate tracking work?
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
Create an Affiliate Program with Next.js
Complete guide to setting up an affiliate program in Next.js. Step-by-step integration with code examples and best practices for Next.js developers.
Create an Affiliate Program with Nuxt
Complete guide to setting up an affiliate program in Nuxt. Step-by-step integration with Nuxt 3, server routes, and composables for Vue developers.
Create an Affiliate Program with WordPress
Complete guide to setting up an affiliate program in WordPress. Step-by-step integration with WordPress themes, plugins, and WooCommerce for any WordPress site.
Create an Affiliate Program with Webflow
Complete guide to setting up an affiliate program in Webflow. Step-by-step integration with Webflow CMS, custom code, and forms for no-code developers.
Create an Affiliate Program with React
Complete guide to setting up an affiliate program in React. Step-by-step integration with React hooks, context, and components for React developers.
Ready to Set Up Stripe Affiliate Tracking?
Get started with AffiliateBase today and start tracking Stripe conversions accurately with server-side webhooks.