$billto->setCompany("My company");
$billto->setAddress("588 Willis Ct");
$billto->setCity("Vacaville");
$billto->setState("CA");
$billto->setZip("95688");
$billto->setPhoneNumber("555-555-1212");
$billto->setfaxNumber("999-999-9999");
$billto->setCountry("USA");
// Create a new Customer Payment Profile
$paymentprofile = new AnetAPI\CustomerPaymentProfileExType();
$paymentprofile->setCustomerType('individual');
$paymentprofile->setBillTo($billto);
$paymentprofile->setPayment($paymentCreditCard);
$paymentprofile->setCustomerPaymentProfileId($getcustomerprofileid);
$paymentprofiles[] = $paymentprofile;
// Submit a UpdatePaymentProfileRequest to update an existing create a new Customer Payment Profile
$paymentprofilerequest = new AnetAPI\UpdateCustomerPaymentProfileRequest();
$paymentprofilerequest->setMerchantAuthentication($merchantAuthentication);
$paymentprofilerequest->setCustomerProfileId($getcustomerprofileid);
$paymentprofilerequest->setPaymentProfile($paymentprofile);
$paymentprofilerequest->setRefId($refId);
$paymentprofilerequest->setValidationMode("liveMode");
$controller = new AnetController\UpdateCustomerPaymentProfileController($request);
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
if ($response != null && $response->getMessages()->getResultCode() == "Ok") {
    echo "Update Customer Payment Profile SUCCESS: " . "\n";
    $retrievedcustomerprofile = $response->getProfile();
} else {
    echo "Update Customer Payment Profile: ERROR Invalid response\n";
    echo "Response : " . $response->getMessages()->getMessage()[0]->getCode() . "  " . $response->getMessages()->getMessage()[0]->getText() . "\n";
}