How the Referral Flow Works
A detailed walkthrough of the complete referral lifecycle — from code generation through reward fulfillment.
1. Code generation
When a logged-in customer visits the Refer tab in their account, the system generates a unique referral code based on their first name plus a random alphanumeric suffix (e.g. SARAH7K2M). Each customer gets exactly one code per restaurant — subsequent visits retrieve the same code.
The code is created server-side via a secure backend function that verifies the customer's identity before generating or retrieving their code.
2. Sharing
Customers can share their referral in three ways:
- Copy code — Copies the raw code to clipboard for pasting into messages.
- Copy link — Copies a full URL like
yourrestaurant.com/menu?ref=SARAH7K2M&utm_source=referral. - Share button — Uses the device's native share sheet (Web Share API) on mobile for sharing to WhatsApp, iMessage, etc.
3. Checkout validation
The referred friend can apply the code at checkout in two ways:
- Manual entry — Click "Have a referral code?" and type the code. The system validates it in real-time.
- Auto-apply via URL — If the friend visits via a referral link containing
?ref=CODE, the code is automatically applied at checkout once the phone number and subtotal are available.
Referral codes are mutually exclusive with promo codes and points redemption — only one discount type can be active at a time.
4. Validation checks
When a referral code is submitted, the server runs a comprehensive set of validation checks (see Abuse Prevention for full details):
- Is the referral program enabled for this restaurant?
- Does the code exist?
- Is the customer trying to use their own code?
- Has the customer ordered before (existing customer check)?
- Has the referrer hit their monthly limit?
- Does the order meet the minimum value?
- Has this specific person already used this code?
- Do the referrer and referee share the same address?
If all checks pass, the discount amount is calculated and displayed in the order summary.
5. Payment & reward fulfillment
After the referred friend completes payment:
- A referral redemption record is created linking the referrer, referee, order, and discount amount.
- The referrer's reward is automatically processed:
- Loyalty points — Added directly to the referrer's profile balance.
- Discount code — A unique single-use code is generated and added to the restaurant's discount codes.
- The redemption status is updated to completed.
6. Tracking
Both the referrer and admin can track referral activity. The referrer sees their successful referral count in the Refer tab. Admins see full details in the Referral Analytics dashboard and individual customer CRM modals.