$creditCard->setExpirationDate("XXXX");
$paymentCreditCard = new AnetAPI\PaymentType();
$paymentCreditCard->setCreditCard($creditCard);
// Create the Bill To info for new payment type
$billto = new AnetAPI\CustomerAddressType();
$billto->setFirstName("Mrs Mary");
$billto->setLastName("Doe");
$billto->setAddress("1 New St.");
$billto->setCity("Brand New City");
$billto->setState("WA");
$billto->setZip("98004");
$billto->setPhoneNumber("000-000-0000");
$billto->setfaxNumber("999-999-9999");
$billto->setCountry("USA");
// Create the Customer Payment Profile object
$paymentprofile = new AnetAPI\CustomerPaymentProfileExType();
$paymentprofile->setCustomerPaymentProfileId("33211899");
$paymentprofile->setBillTo($billto);
$paymentprofile->setPayment($paymentCreditCard);
// Submit a UpdatePaymentProfileRequest
$request->setPaymentProfile($paymentprofile);
$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";
    // Update only returns success or fail, if success
    // confirm the update by doing a GetCustomerPaymentProfile
    $getRequest = new AnetAPI\GetCustomerPaymentProfileRequest();
    $getRequest->setMerchantAuthentication($merchantAuthentication);
    $getRequest->setRefId($refId);
    $getRequest->setCustomerProfileId("36731856");
$paymentCreditCard = new AnetAPI\PaymentType();
$paymentCreditCard->setCreditCard($creditCard);
// Create the Bill To info for new payment type
$billto = new AnetAPI\CustomerAddressType();
$billto->setFirstName("Jane");
$billto->setLastName("Doe");
$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") {