๐ง๐ฟ๐ฎ๐ฐ๐ธ ๐ฆ๐๐ฟ๐ถ๐ฝ๐ฒ ๐ฅ๐ฒ๐ณ๐ฒ๐ฟ๐ฟ๐ฎ๐น๐ ๐ช๐ถ๐๐ต๐ผ๐๐ ๐๐ผ๐ผ๐ธ๐ถ๐ฒ๐
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:
- Use charge.refunded to reverse commissions.
- Block self referrals. Check if emails match.
- Use coupon codes for tracking.
Stop trusting the browser. Use Stripe to carry the referral to the webhook.