$address01->setCountry("US"); $getTaxRequest->setOriginAddress($address01); // //Destination Address $address02 = new Address(); $address02->setLine1("118 N Clark St"); $address02->setLine2("Suite 100"); $address02->setLine2("ATTN Accounts Payable"); $address02->setCity("Chicago"); $address02->setRegion("IL"); $address02->setPostalCode("60602-1304"); $address02->setCountry("US"); $getTaxRequest->setDestinationAddress($address02); // //Third Address $address03 = new Address(); $address03->setLine1("100 Ravine Lane"); $address03->setLine2("Suite 100"); $address03->setLine2(""); $address03->setCity("Bainbridge Island"); $address03->setRegion("WA"); $address03->setPostalCode("98110"); $address03->setCountry("US"); //Coming Soon //$address03->setLatitude("47.626930"); //$address03->setLongitude("-122.521004"); $getTaxRequest->setAddressCode($address03); // //Set DocumentLevel Addresses $getTaxRequest->setOriginAddress($address01); $getTaxRequest->setDestinationAddress($address02);
<?php require 'vendor/autoload.php'; //Authentication //TODO: Modify the account and license key values // contained set in Credentials.php with your own require 'Credentials.php'; use AvaTax\Address; use AvaTax\AddressServiceSoap; use AvaTax\TextCase; use AvaTax\ValidateRequest; use AvaTax\SeverityLevel; $addressSvc = new AddressServiceSoap('Development'); try { $address = new Address(); $address->setLine1("118 N Clark St"); $address->setLine2(""); $address->setLine3(""); $address->setCity("Chicago"); $address->setRegion("IL"); $address->setPostalCode("60602"); $textCase = TextCase::$Mixed; $coordinates = 1; //Request $validateRequest = new ValidateRequest($address, $textCase ? $textCase : TextCase::$Default, $coordinates); $validateResult = $addressSvc->Validate($validateRequest); //Results echo "\n" . 'Validate ResultCode is: ' . $validateResult->getResultCode() . "\n"; if ($validateResult->getResultCode() != SeverityLevel::$Success) { foreach ($validateResult->getMessages() as $message) { echo $message->getName() . ": " . $message->getSummary() . "\n";