Results 1 to 2 of 2
  1. #1

    application error Using API kit to check Street Level Address Validity - Commercial vs. Residential

    This thread contains the backstory to what I'm trying to accomplish: https://www.zen-cart.com/showthread.php?219741

    I'm trying to use this API from UPS' developer tools: https://www.ups.com/upsdeveloperkit/...urce?loc=en_US

    I've read the documentation in the kit but I have really no knowledge of XML, JSON, or using API's in general. I have an account and an access key for the API but I don't know how to implement it with ZenCart.

    I would like to run a request from this API during step 1 (shipping) of the Zen Cart checkout to see if the chosen shipping address of the customer is residential or commercial (really just residential, or not) and then do x thing depending on what the result of that check is.

    ------

    As of right now I don't think I'm doing it right at all...

    I looked for some API tutorials and one I read led me to try this in my tpl_checkout_chipping_default.php file:

    HTML Code:
    <div id="dump"></div>
    <input type="button" value="JSON" onclick="loadUPS()" />
    Code:
    <script type="text/javascript">
        function loadUPS() {
            $('#dump').html('Loading');
            $.ajax({
                type:'GET',
                url:"https://wwwcie.ups.com/json/XAV",
                username:"my_username",
                password:"my_pass",
                AccessLicenseNumber:"ACCESSKEY",
                success:function(dump) {
                    $('#dump').append(dump);
                },
                dataType:'jsonp'
            });
        };
    </script>
    When I click the dummy button I'm just trying to get any kind of results to appear in the dummy div. Right now all that happens is an error in the console:
    "Refused to execute script from … because its MIME type (‘application/json’) is not executable, and strict MIME type checking is enabled"
    ------

    Could really use some help, I'm not sure if I'm on the right track at all or completely doing it wrong.

  2. #2

    Default Re: Using API kit to check Street Level Address Validity - Commercial vs. Residential

    Oh well the 'GET' is successful after I used dataType:'json', but I don't know how to request specific methods or tell the request that it should use the customer's address for the "Address Validation"

 

 

Similar Threads

  1. UPS Residential vs. Commercial rates
    By TCSDCC in forum Built-in Shipping and Payment Modules
    Replies: 22
    Last Post: 7 Feb 2022, 09:11 PM
  2. Residential vs. Commercial
    By t.harrison in forum Addon Shipping Modules
    Replies: 1
    Last Post: 10 May 2012, 02:07 PM
  3. UPS: Commercial vs Residential
    By asdweb in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 15 Jul 2008, 01:41 PM
  4. UPS Residential or Commercial
    By JackA in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 22 May 2008, 05:24 PM

Posting Permissions

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