- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm using the PayPal SDK lib for PHP and trying to integrate payouts in our system.
I've checked that my sandbox environment and app has enabled payouts but when i try to make a payout following this example I only get the error message "Got Http response code 403 when accessing https://api.sandbox.paypal.com/v1/payments/payouts?sync_mode=true".
So I don't know why i get error code 403 forbidden, because I don't get any more information and the settings looks correct. Has anyone else had this issue?
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I see, unfortunately the sync_mode is deprecated as in our guide at this link
If you try without the sync_mode it will work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I see, unfortunately the sync_mode is deprecated as in our guide at this link
If you try without the sync_mode it will work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the info, but in that case it seems the SDK need an update for payouts. Had to change the source code of the PHP SDK in order to remove the sync mode param and even then i still got response code 400. Solved it with writing a custom curl request instead of using the SDK. So if anyone else has this issue in the future following the example, instead of executing $payout->createSynchronois($apiContext); use curl example below.
$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, $payout->toJSON());
$result = curl_exec($s);
curl_close($s);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually it worked when i changed the source code to ignore sync_mode, but i still couldnt see what the error (400 this time), which turned out to be unsupported currency error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where did you turn this off? Which file, or what code?
I also tried using the CURL example above:
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', 'receiver' => 'email' ] ])); $result = curl_exec($s); curl_close($s);
What am I doing wrong?
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- SetExpressCheckout 10003 error with ITEMCATEGORY=Digital in NVP/SOAP APIs
- Issue with Empty store_info in Response Using /v1/reporting/transactions on Sandbox API in REST APIs
- Add Others data in SDKs
- IPN works in sandbox but not live in Sandbox Environment
- Connecting with site to take payments in Payflow