Forums / Addon Shipping Modules / USPS Shipping (RESTful) (USPSr)

USPS Shipping (RESTful) (USPSr)

Sticky

Views: 54,963

Results 181 to 200 of 558
27 Aug 2025, 3:39 PM
#181
chibipaw avatar

chibipaw

Zen Follower

Join Date:
Jul 2011
Posts:
167
Plugin Contributions:
0

USPS Shipping (RESTful) (USPSr)

I know us stragglers are a real pain but than you nonetheless. I'll give this a try soon, and will report back with any results.

27 Aug 2025, 8:32 PM
#182
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
522
Plugin Contributions:
2

Re: USPS Shipping (RESTful) (USPSr)

Has anyone integrated this module with Shipping Boxes Manager?

marcopolo
Zen Cart 2.2.2 | PHP 8.5.11 | MariaDB 10.11.14

27 Aug 2025, 8:39 PM
#183
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

marcopolo:

Has anyone integrated this module with Shipping Boxes Manager?
Has not occured to me to merge the two but I will look into it.

29 Aug 2025, 4:30 PM
#184
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: USPS Shipping (RESTful) (USPSr)

We have the latest non-encapsulated version installed on a 1.5.8a site.

PHP 7.4.33
OPC 2.4.6 allowing Guest Checkout
Clone of Bootstrap 3.6.0

We've done the changes to includes/modules/shipping/uspsr.php mentioned in p;ost #179.

Turned on Generate Logs and Show Errors.

No USPS options are showing on either the shopping cart's shipping estimator or after a shipping address is entered in Guest Checkout.

After basic information, the log states:

2025-08-29 16:14:22: No token detected, requesting session token from USPS
Token Request
{
    "grant_type": "client_credentials",
    "client_id": "***********",
    "scope": "domestic-prices addresses international-prices service-standards shipments"
}


2025-08-29 16:14:22: 
==================================


TOKEN RESPONSE FROM USPS:


{
    "access_token": "eyJraWQiOiJIdWpzX2F6UnFJUzBpSE5YNEZIRk96eUwwdjE4RXJMdjNyZDB--DELETED--i-YqJm6xY529kEa0WZ0YOLiCVPz6eUeJpigtSeCwSd4wdwFb6KT9eeUuaOEud_WxVaEYc5CDDlc3IxbReOfbNsUuWKfsQ3_f1lMATerBYOuRWxP70UttzUJEEj52xY7_f6lAYlV7ge47RlyNldNTlqymSOiRx6chW9BwADYBjerVGQl3bGAkJZi4EAh0UFc3H_sxftaMOE7KK2WJRx8CRI2tQZ7wERzjnt6AhCLrKk1uDOmFUYegPwZLUhWL9ia2g-eI406x5UbLXgyQe4BVLZZ-Hv8Kz6SI74x8j8XnLvd7vWOaaw9PUmGrPoBx4OWCvsBbairyo1HJsWvO6OAag",
    "token_type": "Bearer",
    "issued_at": 1756484062962,
    "expires_in": 28799,
    "status": "approved",
    "scope": "domestic-prices addresses international-prices service-standards shipments",
    "issuer": "https://keyc.usps.com/realms/USPS",
    "client_id": "***********************",
    "application_name": "*********",
    "api_products": "[Public Access I]",
    "public_key": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF1UjQzS0hRdm44UlYybWplMEczSAptKzI3dnA4Z-- DELETED --Q0xwYVcwTG1GVGoyYUpTOUt3TnhHb2pIakV5TjhIVG5zd1lOKzdQNVlLVmxobHUKL1FJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t"
}




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


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

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

29 Aug 2025, 4:32 PM
#185
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

dbltoe:

We have the latest non-encapsulated version installed on a 1.5.8a site.

PHP 7.4.33
OPC 2.4.6 allowing Guest Checkout
Clone of Bootstrap 3.6.0

We've done the changes to includes/modules/shipping/uspsr.php mentioned in p;ost #179.

Turned on Generate Logs and Show Errors.

No USPS options are showing on either the shopping cart's shipping estimator or after a shipping address is entered in Guest Checkout.

After basic information, the log states:

```
2025-08-29 16:14:22: No token detected, requesting session token from USPS
Token Request
{
"grant_type": "client_credentials",
"client_id": "***********",
"scope": "domestic-prices addresses international-prices service-standards shipments"
}

2025-08-29 16:14:22:

TOKEN RESPONSE FROM USPS:

{
"access_token": "eyJraWQiOiJIdWpzX2F6UnFJUzBpSE5YNEZIRk96eUwwdjE4RXJMdjNyZDB--DELETED--i-YqJm6xY529kEa0WZ0YOLiCVPz6eUeJpigtSeCwSd4wdwFb6KT9eeUuaOEud_WxVaEYc5CDDlc3IxbReOfbNsUuWKfsQ3_f1lMATerBYOuRWxP70UttzUJEEj52xY7_f6lAYlV7ge47RlyNldNTlqymSOiRx6chW9BwADYBjerVGQl3bGAkJZi4EAh0UFc3H_sxftaMOE7KK2WJRx8CRI2tQZ7wERzjnt6AhCLrKk1uDOmFUYegPwZLUhWL9ia2g-eI406x5UbLXgyQe4BVLZZ-Hv8Kz6SI74x8j8XnLvd7vWOaaw9PUmGrPoBx4OWCvsBbairyo1HJsWvO6OAag",
"token_type": "Bearer",
"issued_at": 1756484062962,
"expires_in": 28799,
"status": "approved",
"scope": "domestic-prices addresses international-prices service-standards shipments",
"issuer": "https://keyc.usps.com/realms/USPS",
"client_id": "**************",
"application_name": "
",
"api_products": "[Public Access I]",
"public_key": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF1UjQzS0hRdm44UlYybWplMEczSAptKzI3dnA4Z-- DELETED --Q0xwYVcwTG1GVGoyYUpTOUt3TnhHb2pIakV5TjhIVG5zd1lOKzdQNVlLVmxobHUKL1FJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t"
}


CommErr (should be 0): 0 -

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

">> 

Was there a ZenCart error generated?
29 Aug 2025, 4:49 PM
#186
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

retched:

Was there a ZenCart error generated?

I'm running the same exact identical build, 1.3 2 USPSr with the same PHP 7 and I get options fine. Is there an error message generated or displayed anywhere?

29 Aug 2025, 5:02 PM
#187
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: USPS Shipping (RESTful) (USPSr)

I tried bumping it to PHP 8.1, which threw a 500 for another item in that store.

Dropped back to 8.0 with no display logs but did find this in the logs folder:

[29-Aug-2025 16:53:58 UTC] Request URI: /index.php?main_page=shopping_cart, IP address: *************, Language id 1#1  uspsr->update_status() called at [/home/soycnanc/public_html/includes/modules/shipping/uspsr.php:182]
#2  uspsr->__construct() called at [/home/soycnanc/public_html/includes/classes/shipping.php:91]
#3  shipping->__construct() called at [/home/soycnanc/public_html/includes/modules/shipping_estimator.php:161]
#4  require(/home/soycnanc/public_html/includes/modules/shipping_estimator.php) called at [/home/soycnanc/public_html/includes/templates/boot_soyc/modalboxes/tpl_shipping_estimator.php:19]
#5  require(/home/soycnanc/public_html/includes/templates/boot_soyc/modalboxes/tpl_shipping_estimator.php) called at [/home/soycnanc/public_html/includes/templates/boot_soyc/templates/tpl_shopping_cart_default.php:204]
#6  require(/home/soycnanc/public_html/includes/templates/boot_soyc/templates/tpl_shopping_cart_default.php) called at [/home/soycnanc/public_html/includes/templates/boot_soyc/common/tpl_main_page.php:216]
#7  require(/home/soycnanc/public_html/includes/templates/boot_soyc/common/tpl_main_page.php) called at [/home/soycnanc/public_html/index.php:94]
--> PHP Warning: foreach() argument must be of type array|object, string given in /home/soycnanc/public_html/includes/modules/shipping/uspsr.php on line 1731.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

29 Aug 2025, 5:39 PM
#188
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

dbltoe:

I tried bumping it to PHP 8.1, which threw a 500 for another item in that store.

Dropped back to 8.0 with no display logs but did find this in the logs folder:

[29-Aug-2025 16:53:58 UTC] Request URI: /index.php?main_page=shopping_cart, IP address: *************, Language id 1#1 uspsr->update_status() called at [/home/soycnanc/public_html/includes/modules/shipping/uspsr.php:182]
#2 uspsr->__construct() called at [/home/soycnanc/public_html/includes/classes/shipping.php:91]
#3 shipping->__construct() called at [/home/soycnanc/public_html/includes/modules/shipping_estimator.php:161]
#4 require(/home/soycnanc/public_html/includes/modules/shipping_estimator.php) called at [/home/soycnanc/public_html/includes/templates/boot_soyc/modalboxes/tpl_shipping_estimator.php:19]
#5 require(/home/soycnanc/public_html/includes/templates/boot_soyc/modalboxes/tpl_shipping_estimator.php) called at [/home/soycnanc/public_html/includes/templates/boot_soyc/templates/tpl_shopping_cart_default.php:204]
#6 require(/home/soycnanc/public_html/includes/templates/boot_soyc/templates/tpl_shopping_cart_default.php) called at [/home/soycnanc/public_html/includes/templates/boot_soyc/common/tpl_main_page.php:216]
#7 require(/home/soycnanc/public_html/includes/templates/boot_soyc/common/tpl_main_page.php) called at [/home/soycnanc/public_html/index.php:94]
--> PHP Warning: foreach() argument must be of type array|object, string given in /home/soycnanc/public_html/includes/modules/shipping/uspsr.php on line 1731.

In your configuration, are you limiting who can use the shipping module by zone with one item in it?
29 Aug 2025, 5:53 PM
#189
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: USPS Shipping (RESTful) (USPSr)

Yes, the product only ships in the continental US.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

29 Aug 2025, 6:04 PM
#190
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

dbltoe:

Yes, the product only ships in the continental US.
Yup that's what it is. Thought I got that one a while ago. This is going to happen regarding of PHP version.

Need a bit for this.

29 Aug 2025, 11:21 PM
#191
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

So... I'm having a bit of a conundrum...Is it normal that the Shipping Estimator isn't setting the zone_id variable of the $order-> object? If that's normal behavior, I can proceed.

30 Aug 2025, 2:29 PM
#192
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,110
Plugin Contributions:
56

Re: USPS Shipping (RESTful) (USPSr)

retched:

So... I'm having a bit of a conundrum...Is it normal that the Shipping Estimator isn't setting the zone_id variable of the $order-> object? If that's normal behavior, I can proceed.
On initial entry to the shipping-estimator, only the country (which is set to the store's default country) is guaranteed to be set.

30 Aug 2025, 6:57 PM
#193
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

lat9:

On initial entry to the shipping-estimator, only the country (which is set to the store's default country) is guaranteed to be set.

Well, I meant that if it was normal for the shipping estimator not to change or set any details of the $order object as a whole when making selections. But I managed to get around this, though.

There is a solution ready that I would like some testing with to make sure it's doing what its supposed to be doing. It's currently on the "restriction-bug" branch of the repo:
https://github.com/retched/ZC-USPSRestful/tree/restriction-bug

I've done light testing on ZC 1.5.8 and 2.1.0 at the "minimum" PHP versions. But would rather get more people to validate it before I go through the process of stamping and publishing. DMs are open if anything.

30 Aug 2025, 7:16 PM
#194
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

For those that are not familiar with navigating a repository on GitHub, you can just navigate to this page:
https://github.com/retched/ZC-USPSRestful/blob/restriction-bug/zc_plugins/USPSRestful/v0.0.0/catalog/includes/modules/shipping/uspsr.php

Or download the uspsr.php file attached:

Attachment #21037

Once downloaded, directly upload in place of the uspsr.php file where necessary (if encapsulated, modify the /zc_plugins/ZC-USPSRestful/vXXX/catalog/includes/modules/shipping/uspsr.php . If not, /includes/modules/shipping/uspsr.php . This will render your installation as 0.0.0 as I did not assign a version number yet.)

30 Aug 2025, 10:02 PM
#195
chibipaw avatar

chibipaw

Zen Follower

Join Date:
Jul 2011
Posts:
167
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

retched:

For those that are not familiar with navigating a repository on GitHub, you can just navigate to this page:
https://github.com/retched/ZC-USPSRestful/blob/restriction-bug/zc_plugins/USPSRestful/v0.0.0/catalog/includes/modules/shipping/uspsr.php

Or download the uspsr.php file attached:

Attachment #21037

Once downloaded, directly upload in place of the uspsr.php file where necessary (if encapsulated, modify the /zc_plugins/ZC-USPSRestful/vXXX/catalog/includes/modules/shipping/uspsr.php . If not, /includes/modules/shipping/uspsr.php . This will render your installation as 0.0.0 as I did not assign a version number yet.)

I'll see what I can do, hopefully tonight. my 1.5.5f php 7.1 is probably your lowest common denominator, but I am still trying to figure out what is suppressing most of the log messages. Must have been something I've done years ago.

30 Aug 2025, 11:08 PM
#196
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

chibipaw:

I'll see what I can do, hopefully tonight. my 1.5.5f php 7.1 is probably your lowest common denominator, but I am still trying to figure out what is suppressing most of the log messages. Must have been something I've done years ago.

Looking at what I changed, nothing was suppressed but rather a bad logical comparison acted the wrong way and was filtering everything out. It still processed but because nothing stopped the module from proceeding it never found a condition to enable it again. And thus, it turned itself off.

31 Aug 2025, 12:00 PM
#197
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
522
Plugin Contributions:
2

Re: USPS Shipping (RESTful) (USPSr)

retched:

Looking at what I changed, nothing was suppressed but rather a bad logical comparison acted the wrong way and was filtering everything out. It still processed but because nothing stopped the module from proceeding it never found a condition to enable it again. And thus, it turned itself off.

I’m not sure if this is directly related to what you’re working on, but I ran into something similar when converting this module for an older site running Zen Cart 1.5.5 with PHP 5.6. I had to rework how it generates the admin settings, since that was causing an issue where quotes weren’t being returned. That conversion was for version 1.2.0. I haven’t converted 1.3.2 yet, because when I compared it against 1.2.0 there were a lot of differences—mostly styling rather than functional changes—so it ends up being more time-consuming than it should be to sort through.

If you think it might help, I can upload the copy I put together. I fixed a typo from an earlier attempt I uploaded, though honestly I doubt many are still running PHP 5.6 these days.

marcopolo
Zen Cart 2.2.2 | PHP 8.5.11 | MariaDB 10.11.14

31 Aug 2025, 1:32 PM
#198
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

marcopolo:

I’m not sure if this is directly related to what you’re working on, but I ran into something similar when converting this module for an older site running Zen Cart 1.5.5 with PHP 5.6. I had to rework how it generates the admin settings, since that was causing an issue where quotes weren’t being returned. That conversion was for version 1.2.0. I haven’t converted 1.3.2 yet, because when I compared it against 1.2.0 there were a lot of differences—mostly styling rather than functional changes—so it ends up being more time-consuming than it should be to sort through.

If you think it might help, I can upload the copy I put together. I fixed a typo from an earlier attempt I uploaded, though honestly I doubt many are still running PHP 5.6 these days.

Depending on the version used, I think that might have been before I realized that the $method variable had to be specifically called as a part of the quotation method. Also, a lot of what I do in the admin area is a bit hacky, so I can understand a lot of work being needed on it. I might go ahead and try to set up a 5.6 environment and test there.

chibipaw:

I'll see what I can do, hopefully tonight. my 1.5.5f php 7.1 is probably your lowest common denominator, but I am still trying to figure out what is suppressing most of the log messages. Must have been something I've done years ago.

7.3 tends to be the PHP7 version I test on, but I'm getting the same results on the earlier ZC/PHP combos too. This is more or less me trying to spot check for faults as I keep making these changes for the new versions.

31 Aug 2025, 1:59 PM
#199
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
522
Plugin Contributions:
2

Re: USPS Shipping (RESTful) (USPSr)

retched:

Depending on the version used, I think that might have been before I realized that the $method variable had to be specifically called as a part of the quotation method. Also, a lot of what I do in the admin area is a bit hacky, so I can understand a lot of work being needed on it. I might go ahead and try to set up a 5.6 environment and test there.

7.3 tends to be the PHP7 version I test on, but I'm getting the same results on the earlier ZC/PHP combos too. This is more or less me trying to spot check for faults as I keep making these changes for the new versions.

Here is the the converted version of USPSRestful-1.2.0 I did works fine on Zencart 1.5.5f - using PHP 5.6

marcopolo
Zen Cart 2.2.2 | PHP 8.5.11 | MariaDB 10.11.14

31 Aug 2025, 2:02 PM
#200
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: USPS Shipping (RESTful) (USPSr)

So far, it seems to be working on the site using the single zone and non-encapsulated version.

Let me know when you have something without a warning.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com