访问PayPal支付api端点时收到Http响应代码403

时间:2019-05-14 23:52:32

标签: paypal payment-gateway payout

沙盒工作正常,但是当我打开它时,它显示-访问https://api.paypal.com/v1/payments/payouts时得到了Http响应代码403。 我的REST应用程序上也启用了付款服务。

我的付款功能在这里:

public function singlePayout(Request $request)
{
    $payouts = new Payout();
    $senderBatchHeader = new PayoutSenderBatchHeader();
    $senderBatchHeader->setSenderBatchId(uniqid())
        ->setEmailSubject("You have a redeem amount.");

    $senderItem1 = new PayoutItem();
    $senderItem1->setRecipientType('Email')
        ->setNote("Thanks for your patronage")
        ->setReceiver($withdrawRequest->paypal_acc_email)
        ->setSenderItemId(uniqid())
        ->setAmount(new Currency(json_encode([
            'value' => $request->amount,
            'currency' => 'USD'
        ])));

    $payouts->setSenderBatchHeader($senderBatchHeader)
        ->addItem($senderItem1);
    $request = clone $payouts;

    try {
        $createPayout = $payouts->create(null, $this->_paypal_api_context);
        $payoutBatchID = $createPayout->batch_header->payout_batch_id;
        $payoutBatchDetail = $payouts->get($payoutBatchID, $this->_paypal_api_context);
        $payoutItemTransactionStatus = $payoutBatchDetail->items[0]->transaction_status;

    } catch (\Exception $ex) {
        return response()->json([
            'status' => 'failed',
            'msg' => $ex->getMessage()
        ]);
    }

    return response()->json([
        'status' => 'success',
        'info' => 'The recipient for this transaction will receive the amount within a while.',
        'msg' => 'Amount has been transferred successfully.'
    ]);
}

贝宝付款服务有解决方案吗?

0 个答案:

没有答案