【发布时间】:2015-10-29 06:36:36
【问题描述】:
当我每次尝试创建 Paypal 付款时,我都会收到此错误“无法连接到 api.sandbox.paypal.com 端口 443:连接被拒绝”
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$itemSignup = new Item();
$itemSignup->setName('Test');
$itemSignup->setCurrency('EUR');
$itemSignup->setQuantity(1);
$itemSignup->setPrice(self::SIGNUP_PRICE);
$itemList =new ItemList();
$itemList->setItems([$itemSignup]);
$amount = new Amount();
$amount->setCurrency('EUR');
$amount->setTotal(self::SIGNUP_PRICE);
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setItemList($itemList);
$transaction->setDescription('Test');
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl('http://localhost/test/');
$redirectUrls->setCancelUrl('http://localhost/test/');
$payment = new Payment();
$payment->setIntent('Sale');
$payment->setPayer($payer);
$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
try {
$payment->create($this->_apiContext);
} catch(\Exception $e){
dd($e->getMessage());
【问题讨论】:
-
如果这是在 IIS 上,那么您的应用程序池可能需要重新启动
-
等一下,抱歉,请检查您的端口转发。它可能不喜欢返回 localhost 确保你“上线”并尝试你的实际 IP 并确保端口 80 被转发
-
allow_url_fopen 开启
-
抱歉,我更新了那条评论
-
检查你的 apache access.log 看看是否有 SSL 握手错误
标签: php paypal paypal-sandbox paypal-rest-sdk