@affiliateo/web
v2.0.0
Published
Affiliateo web SDK — affiliate attribution and tracking for web apps
Downloads
1,356
Maintainers
Readme
@affiliateo/web
Affiliateo web SDK — pass affiliate attribution metadata to your Stripe checkout.
Install
npm install @affiliateo/webSetup
- Make sure you have the Affiliateo tracking script on your site (for visitor tracking)
- Connect your Stripe account on the Affiliateo dashboard
- Add one line to your Stripe checkout creation:
import { getMetadata } from '@affiliateo/web';
// Your existing checkout route
const session = await stripe.checkout.sessions.create({
line_items: [{ price: 'price_xxx', quantity: 1 }],
mode: 'payment',
success_url: 'https://yoursite.com/success',
cancel_url: 'https://yoursite.com/cancel',
metadata: getMetadata(req),
});That's it. Affiliateo will automatically attribute the purchase to the right affiliate.
How it works
- Your tracking script (
t.js) sets cookies when a visitor arrives via an affiliate link getMetadata(req)reads those cookies and returns them as Stripe metadata- When the payment completes, Affiliateo's webhook reads the metadata and credits the affiliate
Framework support
Works with any Node.js framework:
- Next.js (App Router & Pages Router)
- Express
- Fastify
- Any framework that exposes request cookies
