我正在使用PHP开发PayPal。 我创建了Payout - 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!';
但是当我运行此功能时,它会返回错误 - ' 在访问https://api.sandbox.paypal.com/v1/payments/payouts?sync_mode=true时获得Http响应代码403。'
为什么会发生这种情况,我该如何解决?
非常感谢任何人的帮助。