public function actionPayout() { $payouts = new \PayPal\Api\Payout(); $senderBatchHeader = new \PayPal\Api\PayoutSenderBatchHeader(); $senderBatchHeader->setSenderBatchId(uniqid()) ->setEmailSubject("You have a Payout!"); $senderItem = new \PayPal\Api\PayoutItem(); $senderItem->setRecipientType('Email') ->setNote('Thanks for your patronage!') ->setReceiver('XXXX') ->setSenderItemId("2014031400024") ->setAmount(new \PayPal\Api\Currency('{ "value":"100.0", "currency":"USD" }')); $senderItem1 = new \PayPal\Api\PayoutItem(); $senderItem1->setRecipientType('Email') ->setNote('Thanks for your patronage!') ->setReceiver('CCCCCCCCr') ->setSenderItemId("2014031400029") ->setAmount(new \PayPal\Api\Currency('{ "value":"100.0", "currency":"USD" }')); $payouts->setSenderBatchHeader($senderBatchHeader) ->addItem($senderItem); $request = clone $payouts; // ### Create Payout try { //#$output = $payouts->createSynchronous($apiContext); //$params = array('sync_mode' => 'false'); //$params = array(); //return $payouts->create(null, $apiContext); $clientId = 'XXXXXXX'; $clientSecret = 'ZZZZZZZZZ'; $apiContext = $this->getApiContext($clientId, $clientSecret); $output = $payouts->createSynchronous($apiContext); } catch (PayPalConnectionException $ex) { // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY echo "AAAAAA PayPal Payout GetData:<br>". $ex->getData() . "<br><br>"; ResultPrinter::printError("Created Single Synchronous Payout", "Payout", null, $request, $ex); exit(1); } // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY ResultPrinter::printResult("Created Single Synchronous Payout", "Payout", $output->getBatchHeader()->getPayoutBatchId(), $request, $output); return $output; } always got : "Got Http response code 403 when accessing https://api.sandbox.paypal.com/v1/payments/payouts?sync_mode=true." While I am calling API of $payouts->createSynchronous. All the argument I checked twice is correct. Could you help us to resolve this? Thank you
... View more