Set custom payee in Paypal payment button

cheeseexpert
Contributor
Contributor

I want to use the Paypal payment button (https://www.paypal.com/buttons/smart?flowloggingId=710a23ebb71f6) to pay someone of your choosing, rather than paying the website owner a set amount. Someone suggested I set the payee (https://developer.paypal.com/docs/checkout/integration-features/custom-payee/) as an object within the purchase_units array, but I can't figure out how to do this. Can anyone help? Thanks.

Login to Me Too
2 REPLIES 2

iFlash
Contributor
Contributor

I have the same problem. Example code of Paypal creates an error. If I leave out the "payee" element, the code works, as soon as its in, the code breaks. 

Login to Me Too

iFlash
Contributor
Contributor

I found the solution. The example in the Paypal documentation is wrong. The payee section needs to be part of the "purchase_units" array and not part of "amount" array. So it should look like this:

 

'purchase_units'=>[0=>[
    'payee'=>[
         'email_address'=>'some email address'
    ],
    'amount'=>[
...

 

Hope this helps.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.