I am trying to implement the promo code system. Where I can refer a friend and both will get a discount. I kind of know what to do. I have a created a promo code table. Now i need to find a way to distribute a promo code. I was thinking about sending an email. But the problem is the user need to be loggin first .
Once the firsdt user purchase the item it will use the existing promo code and append the user id to a promo-code and in this case I will know who send the promo code.
Please advice what would be best approach to distribute the promo code in a best manner.