PHP (Laravel) - Authorization Error result when using Payouts
moxiefitness
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Feb-06-2018
07:49 PM
I'm trying to use the PayPal Payouts with a sandbox app.
Using postman-
1. I get the access_token from https://api.sandbox.paypal.com/v1/oauth2/token using client_id & client secrete
2. Attempt to make a payout posting https://api.sandbox.paypal.com/v1/payments/payouts
Datatype is json
{ "sender_batch_header": { "sender_batch_id": "5a7a72af05adc", "email_subject": "Payout test" }, "items": [ { "recipient_type": "EMAIL", "note": "Thank you!", "receiver": "--some email not allowed--", "sender_item_id": "20180206001", "amount": { "value": "3.40", "currency": "USD" } } ] }
Response :
{ "name": "AUTHORIZATION_ERROR", "debug_id": "8fece29112011", "message": "Authorization error occurred.", "information_link": "https://developer.paypal.com/docs/api/payments.payouts-batch/#errors" }
Same thing happens when I do it in Laravel :
$payout = new Payout(); $sender_batch_header = new PayoutSenderBatchHeader(); $sender_item = new PayoutItem(); // Payout amount $amount = new Currency(); $amount->setValue('3.4'); $amount->setCurrency('USD'); // Set batch header $sender_batch_header->setSenderBatchId(uniqid()) ->setEmailSubject('Payout test'); // Set the item $sender_item->setRecipientType('EMAIL') ->setNote('Thank you ') ->setReceiver($request['email']) ->setSenderItemId('20180206001') ->setAmount($amount); // Set up the payout $payout->setSenderBatchHeader($sender_batch_header) ->addItem($sender_item); $request = clone $payout; try { $output = $payout->create( null, $this->apiContext); return $output; } catch (PayPalConnectionException $ex) { return $ex->getData(); }
And the exception data is:
{"name":"AUTHORIZATION_ERROR","debug_id":"7bb53dcdde651","message":"Authorization error occurred.","information_link":"https://developer.paypal.com/docs/api/payments.payouts-batch/#errors"}
I have made sure that Payouts is enabled in the sandbox application, and the email accounts I'm using exist in the sandbox accounts as well.
1 REPLY 1
Colin563
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug-28-2019
05:14 AM
I had same problem can you please help me out, in fixing this, how can enable my app to use PayOut API?
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Refunding an order via HATEOAS URL failing with NOT_AUTHORIZED error in Sandbox Environment
- Payouts not working with live Credentials in REST APIs
- Unable to download dispute related attachment via Rest Api in REST APIs
- PayPal API 403 PERMISSION_DENIED on get order and capture order in REST APIs
- invoice api doesn't accept bearer token in REST APIs