Paypal Rest沙盒错误

时间:2015-08-06 08:10:07

标签: php paypal paypal-sandbox paypal-rest-sdk

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

1 个答案:

答案 0 :(得分:1)

要创建付款,网址应为:

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