PayPal Payout failed with 'Got Http response code 403'

575 Views Asked by At

I am working on PayPal with PHP. I create Payout from this - http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payouts/CreateSinglePayout.html

Exactly code is like this:

    $payouts = new Payout();

    $senderBatchHeader = new PayoutSenderBatchHeader();
    $senderBatchHeader->setSenderBatchId(uniqid())
        ->setEmailSubject("You have a Payout!");

    $senderItem = new PayoutItem();
    $senderItem->setRecipientType('Email')
        ->setNote('Thanks for your patronage!')
        ->setReceiver('[email protected]')
        ->setSenderItemId("2014031400023")
        ->setAmount(new Currency('{
                            "value":"1.0",
                            "currency":"USD"
                        }'));

    $payouts->setSenderBatchHeader($senderBatchHeader)
        ->addItem($senderItem);

    $request = clone $payouts;

    try {
        $output = $payouts->createSynchronous(PaypalController::$_api_context);
    } catch (Exception $ex) {
        return 'Error: '. $ex->getMessage();
    }

    return 'Success Payout!';

But when I run this, it returns error - 'Got Http response code 403 when accessing https://api.sandbox.paypal.com/v1/payments/payouts?sync_mode=true.'

Why it happens, How can I solve this?

Thanks much to anyone help.

0

There are 0 best solutions below