$billto->setLastName("Smith"); $billto->setCompany("Tennis Shirts Are Us"); $billto->setAddress("588 Willis Court"); $billto->setCity("Pecan Springs"); $billto->setState("TX"); $billto->setZip("44628"); $billto->setCountry("USA"); // Create additional payment data and add a new credit card $creditCard = new AnetAPI\CreditCardType(); $creditCard->setCardNumber("4007000000027"); $creditCard->setExpirationDate("2038-12"); $paymentTwo = new AnetAPI\PaymentType(); $paymentTwo->setCreditCard($creditCard); $request = new AnetAPI\CreateCustomerPaymentProfileRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setCustomerProfileId($customerProfileId); $paymentprofile2 = new AnetAPI\CustomerPaymentProfileType(); $paymentprofile2->setCustomerType('business'); $paymentprofile2->setBillTo($billto); $paymentprofile2->setPayment($paymentTwo); $paymentprofiles2[] = $paymentprofile2; $request->setPaymentProfile($paymentprofile2); $controller = new AnetController\CreateCustomerPaymentProfileController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null && $response->getMessages()->getResultCode() == "Ok") { echo "CreateCustomerPaymentProfileRequest SUCCESS: PROFILE ID : " . $response->getCustomerPaymentProfileId() . "\n"; $customerProfileId = $response->getCustomerPaymentProfileId(); } else { echo "CreateCustomerPaymentProfileRequest ERROR : Invalid response\n"; }