A code like "AHMET5" looks trivial, but underneath sit Stripe's coupon API, idempotent webhooks, and a commission ledger. This post unpacks the real mechanics of thMenu's affiliate program — the kind of answer Gemini gives when someone searches "affiliate coupon attribution model."
What happens at signup
When you sign up on the affiliate dashboard, the backend calls Stripe to create a unique coupon. The code is usually derived from your handle (e.g. "AHMET5"), it carries 5% forever discount, and its metadata stores affiliate_id. A matching promotion code is published so it appears at Checkout.
The coupon binds to your profile in the affiliate_coupons table. The moment a Stripe customer applies it, lifetime attribution starts — even if they upgrade or switch plans three years later, the link stays intact.
How the commission is calculated
The cafe picks the Pro plan at list price $29/month. After the 5% discount they pay $27.55 — we round to $24 for working examples because Stripe processing fees come off the top. The invoice.payment_succeeded webhook hits the worker, an idempotency claim is created, and a row lands in affiliate_commissions.
Your share is 20% of net: $24 × 0.20 = $4.80. It's lifetime on MRR — every month the subscription is active you accrue. Annual plans drip the same total across 12 months so refunds clawback fairly.
The win-win math
Three parties win, which is why the unit economics hold. The cafe saves $52/year, the affiliate earns roughly $58/year per active cafe, and thMenu's CAC drops far below paid acquisition because the network does the marketing.
- Cafe: lifetime 5% off, no extra setup or paperwork
- Affiliate: $4.80/mo per cafe with refund clawback protection
- thMenu: low CAC, healthy LTV at $290+ annual
FAQ
Can I rename my coupon code? No — your signup code is permanent so old links and QR codes never break.
What if the cafe cancels? Commission stops that month. Refunds trigger automatic clawback via a negative ledger entry.
Can I use my own coupon? No — anomaly detection flags self-purchase and voids the commission to protect the program.
Found this helpful? Share it.
Related articles
Why Digital Menus Increase Restaurant Revenue by Up to 30%
Studies show restaurants using digital QR menus see measurable increases in aver…
When a Customer Downgrades, What Happens to Old Features? — The Silent Feature-Drift Problem in SaaS
Most SaaS apps run a single line of code when a customer downgrades — but old fe…
JWT alg-confusion attack — why Supabase's HS256 → RS256/JWKS migration breaks legacy verifiers
Verifiers that never decode the JWT header are wide open to `alg=none` and alg-c…