๐—ง๐—ฟ๐—ฎ๐—ฐ๐—ธ ๐—ฆ๐˜๐—ฟ๐—ถ๐—ฝ๐—ฒ ๐—ฅ๐—ฒ๐—ณ๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—น๐˜€ ๐—ช๐—ถ๐˜๐—ต๐—ผ๐˜‚๐˜ ๐—–๐—ผ๐—ผ๐—ธ๐—ถ๐—ฒ๐˜€

Browsers block third party cookies. Safari, Firefox, and Chrome do this. You lose referrals before checkout.

Store the referral code in two places. Use a first party cookie on your domain. Use localStorage as a backup. Browsers do not block these.

People miss this step. Do not wait for a webhook to read the cookie. Pass the referral code into the Stripe Checkout Session. Use client_reference_id or metadata.

The referral now lives in the Stripe object. It does not depend on a browser or device.

Listen for checkout.session.completed. Read the reference. This is your attribution. It is server side.

SaaS has recurring payments. Link the affiliate to the Stripe customer. Listen for invoice.paid. Pay commissions on renewals for 12 months.

Keep your data clean:

Stop trusting the browser. Use Stripe to carry the referral to the webhook.

Source: https://dev.to/mihirkanzariya/tracking-affiliate-referrals-on-stripe-without-third-party-cookies-5fh9