PHP SDK - Payout Error

harrisonsmith
Contributor
Contributor

I'm getting an error when using this code. 

 

global $apiContext;
$s = curl_init("https://api.sandbox.paypal.com/v1/payments/payouts");
curl_setopt($s, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/payouts");
curl_setopt($s, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Bearer ' . $apiContext->getCredential()->getAccessToken(array())));
curl_setopt($s,CURLOPT_POST,true);
curl_setopt($s, CURLOPT_POSTFIELDS, $payouts->toJSON([
    'batch_header' => [
        'sender_batch_header' => [
            'email_subject' => 'You\'ve been paid by XXXX'
        ]
    ],
    'payout_item' => [
        'recipient_type' => 'EMAIL',
        'amount' => [
            'value' => '1.00',
            'currency' => 'USD',
        ],
        'note' => 'XXX Ltd.',
        'receiver' => 'email_here'
    ]
]));
$result = curl_exec($s);
curl_close($s);

This is my error:

{"name":"VALIDATION_ERROR","debug_id":"3e8d70b2b31a0","message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments.payouts-batch/#errors","details":[{"field":"items","issue":"size must be between 1 and 15000"},{"field":"sender_batch_header","issue":"may not be null"}]}

Any ideas on how to fix this? The request is coming up in my API calls, but it's not working. I read that it could be something to do with 'sync_mode'... HELP!

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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