Page 2 of 11 FirstFirst 1234 ... LastLast
Results 11 to 20 of 107
  1. #11
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    496
    Plugin Contributions
    0

    Default Re: USPS Shipping (RESTful) (USPSr)

    I was able to download a Encapsualted version from Gethub.

  2. #12
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    496
    Plugin Contributions
    0

    Default Re: USPS Shipping (RESTful) (USPSr)

    I used the same setup that my 2.0.1 version uses successfully and I get an error in the new USPSr 0.2.1 version.

    Error: Missing or malformed access token.

    Is the error referring to the USPS API Consumer Key?

    I am using the same USPS API Consumer Key in both Zencart versions.


    ​[12-Feb-2025 16:38:27 Europe/Berlin] Request URI: /tennesseetraditionalflies.com/index.php?main_page=checkout_shipping, IP address: ::1, Language id 1#0 C:\xampp\htdocs\tennesseetraditionalflies.com\zc_plugins\USPSRestful\v0.2.1\cata log\includes\modules\shipping\uspsr.php(1706): zen_debug_error_handler()
    #1 C:\xampp\htdocs\tennesseetraditionalflies.com\zc_plugins\USPSRestful\v0.2.1\cata log\includes\modules\shipping\uspsr.php(376): uspsr->getBearerToken()
    #2 C:\xampp\htdocs\tennesseetraditionalflies.com\includes\classes\shipping.php(257) : uspsr->quote()
    #3 C:\xampp\htdocs\tennesseetraditionalflies.com\includes\modules\pages\checkout_sh ipping\header_php.php(185): shipping->quote()
    #4 C:\xampp\htdocs\tennesseetraditionalflies.com\index.php(35): require('C:\\xampp\\htdocs...')
    --> PHP Warning: Undefined array key "access_token" in C:\xampp\htdocs\tennesseetraditionalflies.com\zc_plugins\USPSRestful\v0.2.1\cata log\includes\modules\shipping\uspsr.php on line 1706.

  3. #13
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    681
    Plugin Contributions
    8

    Default Re: USPS Shipping (RESTful) (USPSr)

    Hi. You're using one of the unstable versions. 0.2.1 isn't released yet. Can you try to download one of the releases? 0.2.0 is the current version. Meanwhile I'll look into why that error is coming up at all.
    Last edited by retched; 12 Feb 2025 at 07:02 PM.

  4. #14
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    681
    Plugin Contributions
    8

    Default Re: USPS Shipping (RESTful) (USPSr)

    Additionally, did you also set up your module by providing it a API Key and Secret in the ZenCart admin panel?

    That line

    Code:
            $token = $body['access_token'];
    is asking for the access_token from the response.

    If possible, can you enable debugging and send me the log file that's generated from the USPSr module?
    Last edited by retched; 12 Feb 2025 at 07:13 PM.

  5. #15
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    496
    Plugin Contributions
    0

    Default Re: USPS Shipping (RESTful) (USPSr)

    Quote Originally Posted by retched View Post
    Additionally, did you also set up your module by providing it a API Key and Secret in the ZenCart admin panel?

    That line

    Code:
            $token = $body['access_token'];
    is asking for the access_token from the response.

    If possible, can you enable debugging and send me the log file that's generated from the USPSr module?
    Yes, I used the same setup from my Zencart 2.0.1

    Below is the debug.

    2025-02-12 19:38:53:
    Requesting Token from USPS
    Token Request
    {
    "grant_type": "client_credentials",
    "client_id": "725TENNE5719",
    "client_secret": "lgf@USPS9491",
    "scope": "domestic-prices addresses international-prices service-standards shipments"
    }


    2025-02-12 19:38:53:
    ==================================


    TOKEN RESPONSE FROM USPS:


    {
    "error": "invalid_client",
    "error_description": "InvalidApiKey: The client application credentials provided in the request are missing, invalid, inactive or not approved for access.",
    "error_uri": "https://datatracker.ietf.org/doc/html/rfc6749#page-45"
    }




    ---------------------------------
    CommErr (should be 0): 0 -


    ==================================


    USPS Country - $order->delivery[country][iso_code_2]: US


    2025-02-12 19:38:53:


    USPSRestful Configuration Report
    =========================================================
    USPSr build: 0.2.1


    Quote Request Rate Type: Retail
    Quote from main_page: checkout_shipping
    Display Transit Time: No
    Site Weights Based in: lbs (Pounds)
    Site Measurements Based in: Inches
    Shipping ZIP Code Origin: 37135


    Cart Weight: 0.01 lbs
    Total Quote Weight: 0.0165 lbs. , Pounds: 0, Ounces: 0.264
    Maximum: 50 Tare Rates: Small/Medium: 65:0 Large: 0:2
    Order Handling method: Box, Handling fee Domestic (Order): $1.25, Handling fee International (Order): $5.00


    Services Selected:
    Domestic Methods: Ground Advantage, Priority
    International Methods: - None -


    Categories Excluded from Media Mail: - None -
    Zip Codes Allowed for USPS Connect : - None -
    Add-Ons Enabled (Domestic): - None -
    Add-Ons Enabled (International): - None -


    Assumed Domestic Package Size - Length: 8.625, Width: 5.375, Height: 1.625
    Assumed International Package Size - Length: 8.625, Width: 5.375, Height: 1.625
    Are Packages are Machinable? : Irregular
    Sort the returned quotes by: Price-LowToHigh


    Order is eligible for Media Mail ? YES
    Order SubTotal: $3.00
    Order Total: $3.29
    Uninsurable Portion: $0.00
    Insurable Value: $3.29


    2025-02-12 19:38:53: Sending Services request to USPS
    2025-02-12 19:38:54:
    ==================================


    REQUEST FROM STORE:


    {
    "originZIPCode": "37135",
    "destinationZIPCode": "37135",
    "weight": 0.0165,
    "length": 8.625,
    "width": 5.375,
    "height": 1.625,
    "mailClasses": [
    "USPS_GROUND_ADVANTAGE",
    "PRIORITY_MAIL",
    "PRIORITY_MAIL_EXPRESS",
    "MEDIA_MAIL"
    ],
    "priceType": "RETAIL",
    "extraServices": [
    ],
    "itemValue": 3.2924999999999995,
    "mailingDate": "2025-02-13"
    }




    ---------------------------------
    CommErr (should be 0): 0 -


    ==================================


    USPS Country - $order->delivery[country][iso_code_2]: US


    2025-02-12 19:38:54:
    ==================================
    RAW JSON FROM USPS:


    {
    "apiVersion": "/prices/v3",
    "error": {
    "code": "401",
    "message": "Missing or malformed access token.",
    "errors": [
    {
    "title": "invalid_token",
    "detail": "The access token presented with the request is missing or malformed (not a JWT).",
    "source": "Access Token"
    }
    ]
    }
    }




    2025-02-12 19:38:54:
    ===============================================
    Reviewing selected method options...
    Array
    (
    [0] => Array
    (
    [method] => USPS Ground Advantage Machinable Single-piece
    [handling] => 1.30
    )


    [1] => Array
    (
    [method] => Priority Mail Machinable Single-piece
    [handling] => 1.30
    )


    )


    2025-02-12 19:38:54:
    ===============================================
    Building options...


    2025-02-12 19:38:54:
    ===============================================
    Revoking Bearer Token...


    2025-02-12 19:38:54: Revoking a Token from USPS
    Revocation Request
    {
    "client_id": "725TENNE5719",
    "client_secret": "lgf@USPS9491",
    "revoke_token": null,
    "token_type": "access_token"
    }


    2025-02-12 19:38:54:
    ==================================


    TOKEN RESPONSE FROM USPS:


    {
    "error": "invalid_client",
    "error_description": "InvalidApiKey: The client application credentials provided in the request are missing, invalid, inactive or not approved for access.",
    "error_uri": "https://datatracker.ietf.org/doc/html/rfc6749#page-45"
    }




    ---------------------------------
    CommErr (should be 0): 0 -


    ==================================


    USPS Country - $order->delivery[country][iso_code_2]: US

  6. #16
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    681
    Plugin Contributions
    8

    Default Re: USPS Shipping (RESTful) (USPSr)

    Quote Originally Posted by jodean View Post
    "client_id": "725TENNE5719",
    "client_secret": "lgf@USPS9491",
    Yup, like I thought. You're using the old WebTools API login details. As stated on the readme:
    I already have a USERID and PASSWORD under the old system, but I'm getting error messages while I try to retrieve quotes.
    The older USERID and PASSWORD are not valid for the new system. You will need to provision new credentials under the new USPS API system. Additionally, you SHOULD create an entire new USPS Business Account provided that you don't already have one for your business.

    You may want to head over to this page and read how to obtain valid API Credentials: https://github.com/retched/ZC-USPSRe...ted#installing

    Let me know if you need help. Send me a DM or @retched on Discord.
    Last edited by retched; 12 Feb 2025 at 08:12 PM.

  7. #17
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    496
    Plugin Contributions
    0

    Default Re: USPS Shipping (RESTful) (USPSr)

    Quote Originally Posted by retched View Post
    Yup, like I thought. You're using the old WebTools API login details. As stated on the readme:
    I already have a USERID and PASSWORD under the old system, but I'm getting error messages while I try to retrieve quotes.
    The older USERID and PASSWORD are not valid for the new system. You will need to provision new credentials under the new USPS API system. Additionally, you SHOULD create an entire new USPS Business Account provided that you don't already have one for your business.

    You may want to head over to this page and read how to obtain valid API Credentials: https://github.com/retched/ZC-USPSRe...ted#installing

    Let me know if you need help. Send me a DM or @retched on Discord.
    You were on target. I missed the instructions to set up a new USPS account. Now it works

    Thanks

  8. #18
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    681
    Plugin Contributions
    8

    Default Re: USPS Shipping (RESTful) (USPSr)

    Quote Originally Posted by jodean View Post
    You were on target. I missed the instructions to set up a new USPS account. Now it works

    Thanks
    No problem. There will be an update coming out soon(?) that will disable the module if it can't grab a key. Writing up now.

  9. #19
    Join Date
    Oct 2007
    Posts
    70
    Plugin Contributions
    0

    Default Re: USPS Shipping (RESTful) (USPSr)

    Using 1.5.7c and installed the non-encapsulated version. Couple of issues. In the admin panel the module didn't show and it gave an error because it was looking for uspsr.php in the languages>english>modules>shipping folder. The file is actually named lang.uspsr.php. So I just renamed it to uspsr.php and then the module showed up and I was able to configure it. The module works but it also is not grabbing some of the names correctly. For instance when you get a quote it would show MODULE_SHIPPING_USPSR_TEXT_SHORT_TITLE (Ground Advantage) to the user.

    I edited line 245 in the module and just changed it to $this->title = 'United States Postal Service';

    It does something similar with the name of the module under the admin>module>shipping.

    I was able to edit those to get things looking right. Not sure why its not getting the data from the other files. My issue is with the other usps module you could select the weight for each shipping type. For instance I only want up to 1 lb for ground advantage and priority limited to 1 lb or more. Is there a way to put that option back in or any idea where to edit the files to manually put that back in?

  10. #20
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,338
    Plugin Contributions
    94

    Default Re: USPS Shipping (RESTful) (USPSr)

    Quote Originally Posted by spyderrobotics View Post
    Using 1.5.7c and installed the non-encapsulated version. Couple of issues. In the admin panel the module didn't show and it gave an error because it was looking for uspsr.php in the languages>english>modules>shipping folder. The file is actually named lang.uspsr.php. So I just renamed it to uspsr.php and then the module showed up and I was able to configure it. The module works but it also is not grabbing some of the names correctly. For instance when you get a quote it would show MODULE_SHIPPING_USPSR_TEXT_SHORT_TITLE (Ground Advantage) to the user.

    I edited line 245 in the module and just changed it to $this->title = 'United States Postal Service';

    It does something similar with the name of the module under the admin>module>shipping.

    I was able to edit those to get things looking right. Not sure why its not getting the data from the other files. My issue is with the other usps module you could select the weight for each shipping type. For instance I only want up to 1 lb for ground advantage and priority limited to 1 lb or more. Is there a way to put that option back in or any idea where to edit the files to manually put that back in?
    Right, the USPS/RESTful provides only new-style language files (i.e. lang.uspsr.php); that form of language-file was introduced in zc158.

 

 
Page 2 of 11 FirstFirst 1234 ... LastLast

Similar Threads

  1. PayPal RESTful API Payment Module
    By lat9 in forum PayPal RESTful support
    Replies: 261
    Last Post: 21 Apr 2025, 08:22 PM
  2. v158 UPS Shipping using RESTful/OAuth API [Support Thread]
    By lat9 in forum Addon Shipping Modules
    Replies: 147
    Last Post: 8 Mar 2025, 06:38 PM
  3. v155 USPS Shipping Module - We are unable to find a USPS shipping quote suitable....
    By jtovar in forum Built-in Shipping and Payment Modules
    Replies: 9
    Last Post: 6 May 2019, 11:07 PM
  4. v155 V1.5.5D USPS Shipping module, I just noticed, no USPS retail Ground Displaying
    By WiccanWitch420 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 31 Mar 2018, 04:34 PM
  5. v139h Is the USPS shipping module required to ship with USPS?
    By yeahwhatever in forum Addon Shipping Modules
    Replies: 3
    Last Post: 14 Feb 2012, 12:58 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR