I have developed a referral promo code system. And now i need to show the discount amount to a person who will issue the discount. I have 2 tables: PromoCodeTracker and PromoCodeUSe. they linked in by ID.
The first table have a list of promo codes that been generated for each user . The second table is the use of those promo code.
The logic is : if you refer someone who make a purchase you get $50 (only if you did not use the code to purchase)
you get $25 if you already use someone code (which already applyed to a purchase) and someone else is used your code