If you use stripe and have a referral system in place (You discount customer subscriptions for every person they refer by a certain amount) then I'd love to know how you've built it.
Stripe has:
Coupon codes (cannot be stacked)
Negative Invoice balances (Adding say, -$5 to an invoice would essentially discount by $5)