Overview
Use this setup when you do not want to load the Affonso browser pixel and prefer to control tracking yourself. In this flow, your application is responsible for:- reading the affiliate tracking parameter from the landing URL
- creating the click through
POST /v1/clicks - storing the returned
click_idin a cookie, session, or database - reusing that identifier for signup and conversion tracking
1. Create a click when affiliate traffic lands
When a visitor arrives through an affiliate link such ashttps://yourdomain.com?ref=partner123, read the tracking parameter on your
server, create the click in Affonso, and store the returned ID.
Example server-side flow:
- set your own first-party cookie such as
affonso_referral - keep the
click_idin the user’s server session - attach it to a pending signup record in your database
click_id later.
2. Convert the click into a lead on signup
When the visitor creates an account, callPOST /v1/signups with the stored
click_id plus the user data you want to associate with the referral.
cURL
- send at least
emailorexternal_user_id - call this after successful registration, or after email verification if you use double opt-in
- the endpoint is idempotent for the same
click_id
3. Pass referral data to your payment provider
Once you have stored theclick_id, decide how you want to hand it off to your
payment flow.
Choose one of these paths:
Option 1: Use a supported payment provider integration
If you use a payment provider that Affonso integrates with directly, start with that. It is usually the easiest setup. Supported providers include:- Stripe
- Polar
- Paddle
- Dodo Payments
- Creem
- initial payments
- recurring renewals
- refunds
When to choose this option
Choose this path when your billing system already runs on one of the supported providers and you want Affonso to handle the provider event mapping for you.Option 2: Track the paid conversion through the API
If you do not want to use the provider integration, or you use another provider, track the conversion directly through the API. When the customer pays, send the conversion event from your backend:cURL
- use
click_idfor the first backend event if you have not linked the user yet - once signup tracking has associated the referral with your user, prefer
external_user_idorcustomer_id
click_id or your affonso_referral cookie
through the provider’s metadata fields.
Related docs
Track Click
API reference for creating the initial click record.
Record Lead Signup
Convert the stored click into a lead during signup.
Server-Side Tracking
See the backend conversion and event endpoints in more detail.
Payment Provider Guides
Find native integration guides for Stripe, Polar, Paddle, Dodo Payments,
Creem, and more.
Custom Payment Provider Guide
Use this when you need the API-based flow for a non-native provider.
