Amy
Amy

Reputation: 3

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)
    ],
];

Upvotes: 0

Views: 126

Answers (1)

Preston PHX
Preston PHX

Reputation: 30369

'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.

Upvotes: 1

Related Questions