Paypal支付执行

问题描述:

我创建使用信用卡的PayPal应用程序。它正在以批准的状态成功创建付款。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); 

现在我想以完成交易执行此付款,但我无法找到计费用户标识。这是什么计费用户标识和我在哪里怎么得来的?

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

信用卡付款是一个步骤,当付款时 $payment->create($this->_api_context);被批准。

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

你会得到payer_id从 “创建付款” 返回URL(GET方法)。请登录Paypal REST API Reference了解更多详情