2

我正在使用 PHP 开发 PayPal。我由此创建支付 - http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payouts/CreateSinglePayout.html

确切的代码是这样的:

    $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('test@example.com')
        ->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!';

但是当我运行它时,它返回错误 - ' Got Http response code 403 when access https://api.sandbox.paypal.com/v1/payments/payouts?sync_mode=true'

为什么会发生,我该如何解决?

非常感谢任何人的帮助。

4

0 回答 0