Know what must work before you launch
Connect browser referral capture to a server-side Stripe checkout
- Best fit
- Teams evaluating AffiliateBase for a Svelte 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 merchants running an affiliate program in their own Svelte or SvelteKit app. A plain Svelte site can load the script in its HTML shell; SvelteKit projects can use app.html or an appropriate layout.
The generated referral ID exists in the browser. Submit it to the SvelteKit server route or form action that creates Stripe Checkout. A store can hold client state, but it does not attribute a payment by itself.
Use the Stripe checkout requirements and complete the verification checklist on a reachable deployment.
Connect the app shell, checkout request, and Stripe event:
Choose the Checkout Route
Locate the Svelte component that starts checkout and the SvelteKit server route or action that creates the session.
Install the Browser Script
Add the account-specific script to app.html, a shared layout, or the plain Svelte HTML shell so it loads on affiliate landing pages.
<script async src="https://app.affiliatebase.io/track.js" data-account-id="YOUR_ACCOUNT_ID"></script>Pass Referral State Server-Side
Send the generated referral ID in the checkout request, validate it, and set Stripe client_reference_id with the documented metadata mirror.
Test the Published Flow
Open the generated test affiliate link and complete Stripe test checkout through the deployed app.
Confirm the Commission
Verify the completed checkout identifier, sale, and commission. A successful script load or webhook alone is incomplete.
What the SvelteKit Path Provides
Small Client Boundary
Only referral capture and checkout initiation need browser state.
Protected Checkout Creation
Stripe secret-key work remains in a server route or action.
Full-Path Verification
The test follows the buyer from affiliate link through commission creation.
SvelteKit Affiliate Tracking Questions
Does a Svelte store create attribution?
Can server code read the browser global?
How should I test?
Related platform guides
Build an Affiliate Program into Your Astro Site
Add affiliate tracking to an Astro site, pass the generated referral ID into a supported Stripe checkout, and verify the first commission.
Stripe Affiliate Program Setup
Run an affiliate or referral program on Stripe. Connect your account, give partners referral links or promo codes, and track recurring commissions.
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 SvelteKit Checkout
Test the same client and server path your customers use.