How to share my app with referral code

#1

How to share my app with referral code . while user shared my app to the next user on that time i want to share my referral code and next user while install this app there have a field called put your referral code and this shared referral code should pre field the text box

How can i do that any suggestion
any help would be highly appreciated

Thanks