Similar, but old, and ultimately different.
Somewhat related, but I'm using one-time payments, no recurring customers
I've created a PayPal payment system for a single type of item / service, using the sample code provided on PayPal's GitHub. The code I'm using is the first one in the GitHub link, PayPal Payments - similar to Express Checkout in Classic APIs. The client I'm making this for has asked whether it's possible to setup the system so the buyer bears all transaction costs, regardless of their actual amount (they default to 3.4% + €0.35 EUR).
I'm aware that I could just increase the amount to be paid, simply by doing:
$currency = 'EUR';
$transCosts = 0.034*$billAmount + 0.35;
$details = new Details();
$details->setFee($transCosts)
->setSubTotal($billAmount);
$amount = new Amount();
$amount->setCurrency($currency)
->setTotal($transCosts+$billAmount)
->setDetails($details);
but I'd rather have PayPal do this automatically, without me having to use the fee
like this.
I'm going through the official documentation, and am unable to find anything related to this problem.
Is it even possible to do this? If so, how would I pass that to PayPal's payment object? I'm not interested in the total amount of PayPal's fees, just the way of transfering them over to the buyer, and indicating clearly that he's paying it.
It is not possible to do what you're asking with PayPal. Their entire business model is setup as they take a cut from the seller (the cost of using them to receive money - similar to credit card fees): https://www.paypal.com/us/selfhelp/article/what-are-the-fees-for-paypal-accounts-faq690#business
The only way to account for the PayPal fee would be to do as you suggest and charge the user a surcharge. Understandably this is not your decision but if I were you I'd recommend to the client that they not proceed down this route unless they're willing to bake that surcharge into the cost of their product(s).