Search code examples
phppaypalpaypal-sandboxpaypal-rest-sdk

Using PayPal Checkout API, the payee is ignored


I've been trying to use the Checkout SDK to set up a payment to a 3rd party email address in the sandbox. Everything works, but the payee email I specify in the request according to the docs is ignored and replaced by my other default sandbox account no matter what I set it to. Could anybody advise on what I'm doing wrong?

This is the structure I'm using:

$request->body = [
    'intent' => 'CAPTURE',
    'purchase_units' => [
        [
            'amount' => [
                'value' => $amount,
                'currency_code' => $currency
            ],
            'payee' => [
                'email' => $payee->paypal_email
            ],
            'description' => 'One-time donation to ' . $payee->name
        ],
    ],
    'application_context' => [
        'cancel_url' => url('donation_error?' . $this->callbackQuery),
        'return_url' => url('donation_success?' . $this->callbackQuery)
    ],
];

Solution

  • 'email' => ...
    

    This structure isn't right. According to the documentation here and here, the correct key name is email_address

    Unknown keys like 'email' will be ignored.