Php 从Paypal REST API协议获取信用卡ID
您好,我正在贝宝上设置自动计费协议 守则的作用是:Php 从Paypal REST API协议获取信用卡ID,php,paypal,Php,Paypal,您好,我正在贝宝上设置自动计费协议 守则的作用是: $apiContext = new \PayPal\Rest\ApiContext(new \PayPal\Auth\OAuthTokenCredential($this->CLIENT_ID, $this->CLIENT_SECRET)); $agreement = new Agreement(); $agreement->setName('Agreement') ->setDesc
$apiContext = new \PayPal\Rest\ApiContext(new \PayPal\Auth\OAuthTokenCredential($this->CLIENT_ID, $this->CLIENT_SECRET));
$agreement = new Agreement();
$agreement->setName('Agreement')
->setDescription('Base Plan')
->setStartDate('2015-06-01T12:00:00Z');
$plan = new Plan();
$plan->setId($planID);
$agreement->setPlan($plan);
// Add Payer
$payer = new Payer();
$payer->setPaymentMethod('credit_card')->setPayerInfo(new PayerInfo(array(
'email' => $email
)));
// Add Credit Card to Funding Instruments
$creditCard = new CreditCard();
$creditCard->setType($cctype)
->setNumber($ccnumber)
->setExpireMonth($ccexpirymonth)
->setExpireYear($ccexpiryyear)
->setCvv2($ccv);
$fundingInstrument = new FundingInstrument();
$fundingInstrument->setCreditCard($creditCard);
$payer->setFundingInstruments(array(
$fundingInstrument
));
// Add Payer to Agreement
$agreement->setPayer($payer);
$shippingAddress = new ShippingAddress();
$shippingAddress->setLine1('111 First Street')
->setCity('Saratoga')
->setState('CA')
->setPostalCode('95070')
->setCountryCode('US');
$agreement->setShippingAddress($shippingAddress);
try {
$createagreement = $agreement->create($apiContext);
} catch (Exception $ex) {
exit(1);
}
我想得到的是PayPal应该拥有的信用卡ID,以便以后可以使用信用卡的一些信息来更新信用卡等等
我想:
$creditCard->getId();
会起作用,但不会返回任何东西
如何获取信用卡ID?我以前从未使用过PayPal API,但如果此人决定从其现有余额中扣除资金,会发生什么情况?在这种情况下,我会假设没有信用卡ID,对吗?就我所做的而言,PayPal现有余额并不重要,这只适用于那些没有PayPal帐户并且在运行
$creditCard->getId()时使用信用卡付款的人代码>-它究竟返回什么?你看到什么错误了吗?如果您var\u dump
将$creditCard
值输出会怎么样。。。在这种情况下,您会看到什么?getID()返回空白,$creditcard只包含输入的实际信用卡详细信息。