PayPal\Api\CreditCard::setExternalCustomerId PHP Method

setExternalCustomerId() public method

A unique identifier of the customer to whom this bank account belongs. Generated and provided by the facilitator. **This is now used in favor of payer_id when creating or using a stored funding instrument in the vault.**
public setExternalCustomerId ( string $external_customer_id )
$external_customer_id string
    public function setExternalCustomerId($external_customer_id)
    {
        $this->external_customer_id = $external_customer_id;
        return $this;
    }

Usage Example

 public function store(CreditCardInterface $cardInterface, Address $address = null, $externalCustomerId = null, $merchantId = null, $externalCardId = null)
 {
     $dispatcher = $this->connectionService->getDispatcher();
     $apiContext = $this->connectionService->getApiContext();
     $dispatcher->dispatch(CreditCardEvent::STORE_SETUP);
     $creditCard = new CreditCard();
     $creditCard->setType($cardInterface->getType())->setNumber($cardInterface->getNumber())->setExpireMonth($cardInterface->getExpireMonth())->setExpireYear($cardInterface->getExpireYear())->setCvv2($cardInterface->getCsc())->setFirstName($cardInterface->getFirstName())->setLastName($cardInterface->getLastName());
     if ($address instanceof Address) {
         $creditCard->setBillingAddress($address);
     }
     if ($externalCustomerId !== null) {
         $creditCard->setExternalCustomerId($externalCustomerId);
     }
     if ($merchantId !== null) {
         $creditCard->setMerchantId($merchantId);
     }
     if ($externalCardId !== null) {
         $creditCard->setExternalCardId($externalCardId);
     }
     $creditCardEvent = new CreditCardEvent($creditCard);
     $dispatcher->dispatch(CreditCardEvent::STORE_START, $creditCardEvent);
     $result = $creditCard->create($apiContext);
     $creditCardEvent = new CreditCardEvent($result);
     $dispatcher->dispatch(CreditCardEvent::STORE_END, $creditCardEvent);
     return $result;
 }
All Usage Examples Of PayPal\Api\CreditCard::setExternalCustomerId