gpt4 book ai didi

php - Paypal 休息沙盒错误

转载 作者:太空宇宙 更新时间:2023-11-03 16:26:39 24 4
gpt4 key购买 nike

当我尝试创建 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());

最佳答案

要创建付款,url 应该是:

https://api.sandbox.paypal.com/v1/payments/payment

关于php - Paypal 休息沙盒错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31850233/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com