Validate U.S. Business/Resale Tax ID's
Results 1 to 6 of 6

Thread: Validate U.S. Business/Resale Tax ID's

  1. #1
    Senior Member
    Join Date
    Oct 2005
    Location
    Chicago, IL
    Posts
    428

    Validate U.S. Business/Resale Tax ID's

    Has anyone had to validate U.S. Business/Resale Tax ID's or know of any site that offers an API for validation? I saw a couple but they only offered one look-up per day... and we typically need to validate 50-100 per day.

    Otherwise, is the following the best solution for achieving validation? IE setting up a function for each state and using preg_match? Such as:

    PHP Code:
    //---------------
    //----ALABAMA
    //---------------
    function alabama($id$month$year$wholeSale){
        
        
    $dateCheck $year.$month;
        
    $tId strtoupper(trim($id));
        
        
    //check date and write appropriate regexp
        
    if($dateCheck '200607'){
            
    $exp '/^([0]{3})|([0]{4})|R[0-9]{9}$/';
        }else{
            
    //check if they are a wholesaler
            
    if($wholeSale){
                
    $exp '/^EX[0-9]{5}$/';    
            }else{
                
    $exp '/^[0-9]{4}[\\s][0-9]{5}$/';    
            }
            
        }
        
        if(
    preg_match($exp,$tId)){
            return 
    TRUE;    
        }else{
            return 
    FALSE;    
        }

    //end function alabama();


    I appreciate any insight.
    Bob Lob Law

  2. #2
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,851
    Such a thing sounds like a terrible security risk to me. Given that there are 300M american citizens and a number space of only a billion, the likelihood of getting valid SSNs is quite high. Or something.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Chicago, IL
    Posts
    428
    This has nothing to do with personal Social Security #'s.

    I'm checking the pattern of resaler tax id by state, since each state's resaler tax id pattern is different. I should have been more specific. I work for a wholesaler and we require a resaler id(if applicable - some states don't have sales tax) to become a customer and during the application process I just want to match their input to their states resaler tax id pattern.

    The reason for this is b/c we get a lot of end consumers who will just populate bogus data trying to order from us and it takes our staff a lot of time to validate people who cannot purchase from us. I thought if I could throw a flag saying their resaler ID doesn't match their states pattern - it would help stop end consumer submits(not all but some). We do have it noted in many places on our application but it's amazing how many people just fill out the form and try ordering through our application process.... LOTS.

    I guess in my mind I was trying to do something similar to validating a phone number or email address.

    Tomorrow I will follow-up w/ our accounting/credits dept. and seeing if I am doing something wrong. Nothing is out there at all - just in the idea process.

    Thanks for the feedback.
    Bob Lob Law

  4. #4
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,851
    If you just want to make sure they enter the right number of digits (and dashes or spaces or whatever), you could try preg_match. I don't know the exact format of these resaler ids, but this would work for social security numbers and would require dashes:
    PHP Code:
    if (!preg_match('/^\d{3}-\d{2}-\d{4}$/'$some_input)) {
      die (
    "not a match");

    If you also want to cross-check it against the state, that would require parsing out the appropriate digits and writing some additional logic. I'm not sure what this logic would look like without more detail about how resale ids match a state.

    Would it ever happen that the state in your data doesn't match someone's resale id but the information is valid?
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  5. #5
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    Validating the pattern is not enough. I assume you actually need to know if the number is surrently valid, correct?

    I don't know about other states, or of any national system, but CA allows you to check a number online. I'm sure it would be possible to use cURL to post there and parse the response.

    efile.boe.ca.gov/boewebservices/servlet/BOEVerification

  6. #6
    Senior Member
    Join Date
    Oct 2005
    Location
    Chicago, IL
    Posts
    428
    Ideally if we could use cURL or some other service that would work best... I did see a few companies out there that offered a paid service to an API.

    I was actually a little surprised there wasn't more services out there.

    I appreciate the insight. I will follow-up in the next couple of days and mark resolved and post whatever solution we use incase it is helpful for someone else.

    Thanks!
    Bob Lob Law

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •