您好我在PayPal上设置自动结算协议
代码有效:
$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();
会起作用,但它不会返回任何内容,
我如何获得信用卡身份证?