我已根据本教程https://www.paypalobjects.com/webstatic/de_DE/downloads/PayPal-PLUS-IntegrationGuide.pdf
在我的网站上整合了paypal plus
在sandbox
模式下一切正常,但是当我尝试转到live
时,我在显示付款墙时出现错误Forbidden
。在萤火虫NetworkError: 403 Forbidden - https://www.paypal.com/paymentwall/payment-selection
。它看起来像http://joxi.ru/VrwVoeMIKDg5QA
获取php
approval url
代码
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
Yii::app()->params['paypal']['ClientID'], // ClientID
Yii::app()->params['paypal']['ClientSecret'] // ClientSecret
)
);
$apiContext->setConfig(
array(
'mode' => 'live',
)
);
$item1 = new \PayPal\Api\Item();
$item1->setName('Test item')
->setCurrency('USD')
->setQuantity(1)
->setPrice(1);
$itemList = new \PayPal\Api\ItemList();
$itemList->setItems(array($item1));
$payer = new \PayPal\Api\Payer();
$payer->setPaymentMethod('paypal');
$amount = new \PayPal\Api\Amount();
$amount->setCurrency('USD');
$amount->setTotal('1');
$transaction = new \PayPal\Api\Transaction();
$transaction->setAmount($amount);
$transaction->setItemList($itemList);
$transaction->setInvoiceNumber(uniqid());
$transaction->setDescription('Payment for fashion.com');
$host = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . $_SERVER['HTTP_HOST'];
$redirectUrl = new \PayPal\Api\RedirectUrls();
$redirectUrl->setReturnUrl($host . '/shop/pay');
$redirectUrl->setCancelUrl($host . '/shop/pay');
$payment = new \PayPal\Api\Payment();
$payment->setIntent('sale');
$payment->setPayer($payer);
$payment->setRedirectUrls($redirectUrl);
$payment->setTransactions(array($transaction));
$payment = $payment->create($apiContext);
$approvalUrl = $payment->getApprovalLink();
然后我在js
<script type="application/javascript" src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js"></script>
<script>
PAYPAL.apps.PPP({
"approvalUrl": "<?=$approvalUrl?>",
"placeholder": "ppplus",
"mode": "live",
"country": "DE",
"buttonLocation": "outside",
"disableContinue": "continueButton",
"enableContinue": "continueButton",
"showLoadingIndicator": true,
onContinue: function () {
}
});
</script>
<div id="ppplus"></div>
Paypal标题回复
Paypal-Debug-Id: bfd9325f785dd, bfd9325f785dd
我们的客户告诉我们,他与paypal
取得联系,并激活了paypal plus
的帐户。也许我们在代码中有一些错误?或者也许我们试图在一个限制PayPal的国家/地区进行此操作?
更新
我使用实时凭据。在www.paypal.com/paymentwall/payment-selection
的请求中,有User-Agent
标题 -
User-Agent
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
我正在使用标准的paypal api https://github.com/paypal/PayPal-PHP-SDK
答案 0 :(得分:-3)
更改您的代码:
$apiContext->setConfig(
array(
'mode' => 'live',
)
);
要:
$apiContext->setConfig(
array(
'mode' => 'live'
)
);
注意:生活后&#39;没有COMMA