Payment Issue for transaction fees and payment from a user to another user

I was creating a website for Course selling and buying(E.g. Udemy)…I will explain my problem briefly:
X user creates a course, Y users want to buy the course…So this is my problem,
(i) how will Y user pay to X user?
(ii)As a revenue source, My website will collect 20% on each transaction so for example X user’s course price is $100 so, When Y user pays $100, X user receives $80 and my website receives $20.
It will be really helpful if someone can guide me and help me in this problem…