【问题标题】:Paypal Payment Execution贝宝支付执行
【发布时间】:2016-06-11 10:47:52
【问题描述】:

我正在使用信用卡创建一个 PayPal 应用程序。它正在成功创建付款,状态为已批准。

$addr = new Address();
$addr->setLine1($street);
$addr->setCity($city);
$addr->setPostalCode(zip);
$addr->setState($state);
$addr->setCountryCode($code);

$card = new CreditCard();
$card->setNumber($number);
$card->setType($type);
$card->setExpireMonth($m);
$card->setExpireYear($y);
$card->setCvv2($cvv);
$card->setFirstName($fname);
$card->setLastName($lname);
$card->setBillingAddress($addr);

$fi = new FundingInstrument();
$fi->setCreditCard($card);

$payer = new Payer();
$payer->setPaymentMethod('credit_card');
$payer->setFundingInstruments(array($fi));

$amountDetails = new Details();
$amountDetails->setSubtotal('100');
$amountDetails->setTax('10');
$amountDetails->setShipping('10');

$amount = new Amount();
$amount->setCurrency('JPY');
$amount->setTotal('120');
$amount->setDetails($amountDetails);

$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setDescription('This is the payment transaction description.');

$payment = new Payments();
$payment->setIntent('sale');
$payment->setPayer($payer);
$payment->setTransactions(array($transaction));

$payment->create($this->_api_context);

现在我正在尝试执行此付款以完成交易,但我找不到付款人 ID。这个付款人 ID 是什么?我从哪里得到它?

$payer_id = ?;
$paymentExecution = new PaymentExecution();
$paymentExecution->setPayerId($payer_id);
$payment->execute($paymentExecution, $this->_api_context);

【问题讨论】:

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


    【解决方案1】:

    您将从“创建付款”的返回 URL(GET 方法)中获得 payer_id。查看Paypal REST API Reference了解更多详情

    【讨论】:

      【解决方案2】:

      信用卡付款是一步完成付款的过程 $payment->create($this->_api_context); 已获批准。

      所以不需要执行步骤($payment->execute($paymentExecution, $this->_api_context);)。此外,在这种情况下,我们不需要付款人 ID。

      【讨论】:

        猜你喜欢
        • 2013-11-11
        • 2015-06-25
        • 2015-05-13
        • 1970-01-01
        • 1970-01-01
        • 2013-09-21
        • 2014-10-26
        • 2011-10-08
        • 2013-04-22
        相关资源
        最近更新 更多