Know what must work before you launch
Connect client-side referral capture to a server-created Stripe Checkout Session
- Best fit
- Teams evaluating AffiliateBase for a Next.js 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
-
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.
This guide is for teams building their own merchant affiliate program in a Next.js application. It covers the App Router and the same client/server boundary also applies to Pages Router projects.
AffiliateBase captures the generated referral ID in the browser. A Route Handler, Server Action, or API route cannot read that browser value unless the client submits it. The server then creates Stripe Checkout with that generated ID, not the public token in the affiliate link.
Next.js documents sitewide third-party scripts in the root layout. Pair that placement with the Stripe handoff instructions and the verification checklist.
Implement and test the browser-to-server handoff:
Map the Checkout Request
Load the Tracking Script
<script async src="https://app.affiliatebase.io/track.js" data-account-id="YOUR_ACCOUNT_ID"></script>
Submit the Generated Referral ID
Test a Fresh Browser Session
Confirm Sale and Commission
What the Next.js Integration Separates
Client Referral Capture
The browser owns the affiliate click and generated referral state.
Server Checkout Creation
Your protected Stripe secret and Checkout Session creation remain server-side.
End-to-End Proof
A completed test checks the handoff, webhook processing, sale, and commission together.
Next.js Affiliate Tracking Questions
Can a Server Component read window.AffiliateBase?
Should client_reference_id contain the ?via value?
Does loading the script prove checkout attribution?
Related Platform Guides
Add an Affiliate Program to Nuxt
Load affiliate tracking in Nuxt, pass the generated referral ID to a server route, and verify a Stripe sale and commission.
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.
Add Affiliate Tracking to a React Checkout
Capture affiliate referrals in a React app, send the generated referral ID to your checkout backend, and verify Stripe attribution.
Add Affiliate Tracking to a Vue Checkout
Capture affiliate referrals in Vue, send the generated referral ID to your checkout backend, and verify the Stripe sale and commission.
Verify Your Next.js Checkout Path
Test one referral through the same client and server path your customers use.