I am building an e-commerce website where I need to charge the buyer for a purchase e.g. buyer purchased an item in 20$, then 18$ will be transferred to seller account and 2$ will be transferred to application owner as fee. I need to do this transfer in a single transaction.
How can I distribute payment between multiple recipients in a single transaction without letting buyer know about it (case 1), and how can I manage a refund (case 2)?
You can achieve your requirement with PayPal adaptive chained payment.
Adaptive Chained payments enable a sender(buyer) to send a single payment to a primary receiver(You). The primary receiver keeps part of the payment and send remaining money secondary receivers. In this process, the sender(buyer) sees only primary receiver(you) not secondary receivers.
Please check below link for more info about PayPal adaptive chained payment:
https://developer.paypal.com/docs/classic/adaptive-payments/ht_ap-basicChainedPayment-curl-etc/