Search code examples
phplaravel-4paypalpaypal-rest-sdk

Send money using Paypal php rest SDK


I'm trying to include a donation button into my website. The idea is to allow users to send money from their account to the admin account. I used the Paypal REST SDK to send money, but I found that the admin account was charged by the transaction fees which depends on the user's country.

                        $payer = new Payer();
                        $payer->setPaymentMethod('paypal');

                        $amount = new Amount();
                        $amount->setCurrency('EUR')
                                ->setTotal($money);

                        $transaction = new Transaction();
                        $transaction->setAmount($amount)

                        ->setDescription('donation');

                        $redirect_urls = new RedirectUrls();
                        $redirect_urls->setReturnUrl(URL::route('funding.status'))

                                ->setCancelUrl(URL::route('funding.status'));


                        $payment = new Payment();
                        $payment->setIntent('Sale')
                                ->setPayer($payer)
                                ->setRedirectUrls($redirect_urls)
                                ->setTransactions(array($transaction));

I'm not selling any product.I just want to fund a project.Is there any way to get the received money getting by the admin account? And can I made the transaction fees charged by the user who send the money?


Solution

  • It is normal in REST/Classic API that the receiver will incur the transaction fee. The model you are looking at is "Adaptive Payments" where you could decide who wants to pay the fee.

    Read

    Basically in Adaptive Payments, if you would wish that the person who sends money should pay the fee , you can do so in Adaptive Payments.For instance, you can use a variable called feesPayer = SENDER in Pay API operation.

    P.S You will need to create a app at apps.paypal.com to make use of Adaptive Payments Feature in PayPal.