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

USPS Shipping (RESTful) (USPSr)

Sticky

Views: 54,963

Results 121 to 140 of 558
10 Aug 2025, 12:44 AM
#121
retched avatar

retched

Totally Zenned

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

USPS Shipping (RESTful) (USPSr)

jimmie:

this is happening on front end
File name is ZC-USPSRestful-main from github
and resides in zc_plugins

I always strongly advise not doing this and using one of the stable releases instead. In effect, you have a developmental version that is hell bound to break. Let me see if I can recreate this but I again strongly caution to only use the stable release.

10 Aug 2025, 2:19 AM
#122
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

i uninstalled shipping module first, then plugin manager uninstall plugin and cleaned up unwanted files.
next downloaded from plugins area
uploaded to plugin manager reinstalled and entered crdentials
and getting same result
2025-08-10 02:17:46:
Requesting Token from USPS
Token Request
{
"grant_type": "client_credentials",
"client_id": "SXCWDtDCb4nPB3BWrXlQYK21KYdng0thqQUJcwAr69SqtUVw",
"scope": "domestic-prices addresses international-prices service-standards shipments"
}

2025-08-10 02:17:47:

TOKEN RESPONSE FROM USPS:

{
"access_token": "eyJraWQiOiJIdWpzX2F6UnFJUzBpSE5YNEZIRk96eUwwdjE4RXJMdjNyZDBoalpNUnJFIiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJlbnRpdGxlbWVudHMiOltdLCJzdWIiOiI1NDAyOTQ0OSIsImNyaWQiOiI4NzU5MTI2Iiwic3ViX2lkIjoiNTQwMjk0NDkiLCJyb2xlcyI6W10sInBheW1lbnRfYWNjb3VudHMiOnsiYWNjb3VudHMiOiIiLCJwZXJtaXRzIjpbeyJwZXJtaXROdW1iZXIiOiJbXSIsInBlcm1pdFpJUCI6IjAwMCJ9XX0sImlzcyI6Imh0dHBzOi8va2V5Yy51c3BzLmNvbS9yZWFsbXMv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aeLulOi9is4cuA",
"token_type": "Bearer",
"issued_at": 1754792266961,
"expires_in": 28799,
"status": "approved",
"scope": "domestic-prices oauth2-oidc addresses international-prices usps:payment_methods openid service-standards-files service-standards locations usps:MIDs shipments",
"issuer": "https://keyc.usps.com/realms/USPS",
"client_id": "SXCWDtDCb4nPB3BWrXlQYK21KYdng0thqQUJcwAr69SqtUVw",
"application_name": "JNS Ship USPS",
"api_products": "[Public Access I]",
"public_key": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF1UjQzS0hRdm44UlYybWplMEczSAptKzI3dnA4ZFh4U25oQTVrSk5VbFVJTmZaYnBtZGR6VWpaV1RRMHU0SWdMaTQ5ZDJlTTR1TVE2NjFNdmNyUE5ZCktvRXBWRkNldzJ5QmhqUjJ0T3A5V0gwODgxQ0x3RWdTY3p6YU4vNDAxQ3BSSXlVTjh1aHVuV29ydzZSdkI2S0oKY1NRaFUyMkVrZ0hpZ3ZJTVpDWGt2dmlaa1ByeWI1cTJIcGtMNjVCcFdBRHBYSklpMGJFaXdFU1RSbm9qdkdZSAp3TXJvOCtwVGdmNEN1ZXdpbTdFaDluNm1nbmZnTWp5MUprcjZVVTUzWU1ZdWRrZzB0NHBUb1QvZWd0MHJjZCtwCjJURk82NG9uU21XRDlyWXh1Q0xwYVcwTG1GVGoyYUpTOUt3TnhHb2pIakV5TjhIVG5zd1lOKzdQNVlLVmxobHUKL1FJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t"
}


CommErr (should be 0): 0 -

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

2025-08-10 02:17:47: Revoking a Token from USPS
Revocation Request
{
"client_id": "SXCWDtDCb4nPB3BWrXlQYK21KYdng0thqQUJcwAr69SqtUVw",
"revoke_token": "eyJraWQiOiJIdWpzX2F6UnFJUzBpSE5YNEZIRk96eUwwdjE4RXJMdjNyZDBoalpNUnJFIiwidHlwIjoiSld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KeP85VLBVPzLgBTufZRpf_7XYfOT09NwbH1GsaDJ-mxJDS3ZFz9chyXIbr0ngfNd6IPQ43rCyNW6dyND-R3JtC_1_l0HOUIqAIgxUp1SC-XzH5fArawwz-bz8MjYc406ERw6_XQAWOFHauRLEbSIX_D9oMP7GCAbW1LBTfsI_LvfEDhnF388c49Ufvn17kQ3d98nanFY9PG_WD3AkhHXaX2XnRrSp-B9lM0BXWunaY2KqtZvf4rEWEfJTi2L9nq_NFUezdzlxl4eSdBmmBOvgvn0l5ffYNACgWEGKBWuVCDKn6ler8aeLulOi9is4cuA",
"token_type": "access_token"
}

2025-08-10 02:17:47:

TOKEN RESPONSE FROM USPS:

{
"error": "invalid_request",
"error_description": "invalid_access_token: Check the value of the access token. It may be missing, have expired or have been revoked.",
"error_uri": "https://datatracker.ietf.org/doc/html/rfc7009#section-2.2.1"
}


CommErr (should be 0): 0 -

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

10 Aug 2025, 2:21 AM
#123
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

this is in settings
United States Postal Service (RESTful)

You will need to have registered an account with USPS at https://developers.usps.com/ to use this module.

You CANNOT use your WebTools API Credentials with this module! You must obtain your credentials by creating a USPS.com account, if you don't have one already. If you're making a new account, make a BUSINESS account. The APIs might not work as well with a Personal Account. You can find the full steps to make credentials on the repository's site.

USPS expects you to use pounds as the weight measure for your products. This module will convert all metric measurements to imperial if you configured the site to use metric.

USPSr Version
v1.2.0

Enable USPS Shipping
True

Full Name or Short Name
Short

Enter the USPS API Consumer Key


Enter the USPS API Consumer Secret


Quote Sort Order
Price-LowToHigh

Overall Handling Fee - US
0

Overall Handling Fee - International
0

Handling Per Order or Per Box
Order

Tax Class
--none--

Tax Basis
Store

Shipping Zones
48 Lower States

Packaging Class - Media Mail
Machinable

Packaging Class - Dimensional Pricing
Rectangular

Packaging Class - Cubic Pricing
Non-Soft

Squash Alike Methods Together
--none--

Display Transit Time
Estimate Transit Time

Handling Time
~1 day

Typical Package Dimensions (Domestic and International)
Domestic Measurements (LWH): 8.625 × 5.375 × 1.625
International Measurements (LWH): 8.625 × 5.375 × 1.625

Shipping Methods (Domestic and International)
Domestic Methods:
Ground Advantage, Priority, Priority Sm. F/R Box, Priority Md. F/R Box

International Methods:
--none--

Categories to Excluded from Media Mail
--none--

Zip Codes Allowed for USPS Connect Local
--none--

Shipping Add-ons (Domestic)
--none--

Shipping Add-ons (International)
--none--

Pricing Levels
Retail

NSA Contract Type
None

USPS Account Number
--none--

Send cart total as part of quote?
Yes

Debug Mode
Generate Logs

Sort Order
0

10 Aug 2025, 2:28 AM
#124
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

also handling time doesnt seem to save

10 Aug 2025, 6:23 AM
#125
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)

jimmie:

also handling time doesnt seem to save

I could have sworn I fixed THAT.

So looking into it, something about the script is now no longer generating OAuth tokens. I'll need about a day to try to fix this. I can make tokens in Postman with new credentials but something isn't adding up right in the plugin's request to the USPS server.

10 Aug 2025, 6:57 AM
#126
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)

Sorry for the late AM response... I may have found it.

Can you try (and this is a bit crude) replacing all https://apis.usps.com to https://apis.usps.com.

In short: make this change on the following:

  • On or about line 2197
  • On or about line 2270
  • On or about line 2271
  • On or about line 2397
  • On or about line 2472

For a total of 5 changes in all.

It seems the USPS did a change to the endpoint URI and didn't announce it (or I somehow missed it). Once you confirm this, I will start making an emergency patch.

10 Aug 2025, 11:36 AM
#127
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

my lines r different
line 2201 CURLOPT_URL => 'https://apis.usps.com/service-standards/v3/estimates?' . $paramsBuild,
lines 2274 2275
'rates-domestic' => 'https://apis.usps.com/prices/v3/total-rates/search',
'rates-intl' => 'https://apis.usps.com/international-prices/v3/total-rates/search',
line 2401 CURLOPT_URL => 'https://apis.usps.com/oauth2/v3/token',
line 2476 CURLOPT_URL => 'https://apis.usps.com/oauth2/v3/revoke',

10 Aug 2025, 12:00 PM
#128
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)

jimmie:

my lines r different
line 2201 CURLOPT_URL => 'https://apis.usps.com/service-standards/v3/estimates?' . $paramsBuild,
lines 2274 2275
'rates-domestic' => 'https://apis.usps.com/prices/v3/total-rates/search',
'rates-intl' => 'https://apis.usps.com/international-prices/v3/total-rates/search',
line 2401 CURLOPT_URL => 'https://apis.usps.com/oauth2/v3/token',
line 2476 CURLOPT_URL => 'https://apis.usps.com/oauth2/v3/revoke',

Yes change those to just https://api.usps.com

(I was typing too fast to notice.)

10 Aug 2025, 12:09 PM
#129
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

are u saying make each line like this
from CURLOPT_URL => 'https://apis.usps.com/service-standards/v3/estimates?' . $paramsBuild,
to CURLOPT_URL => 'https://apis.usps.com/' . $paramsBuild,

10 Aug 2025, 12:11 PM
#130
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)

Close.

Before

line 2201 CURLOPT_URL => 'https://apis.usps.com/service-standards/v3/estimates?' . $paramsBuild,
lines 2274 2275
'rates-domestic' => 'https://apis.usps.com/prices/v3/total-rates/search',
'rates-intl' => 'https://apis.usps.com/international-prices/v3/total-rates/search',
line 2401 CURLOPT_URL => 'https://apis.usps.com/oauth2/v3/token',
line 2476 CURLOPT_URL => 'https://apis.usps.com/oauth2/v3/revoke',

After:

line 2201 CURLOPT_URL => 'https://api.usps.com/service-standards/v3/estimates?' . $paramsBuild,
lines 2274 2275
'rates-domestic' => 'https://api.usps.com/prices/v3/total-rates/search',
'rates-intl' => 'https://api.usps.com/international-prices/v3/total-rates/search',
line 2401 CURLOPT_URL => 'https://api.usps.com/oauth2/v3/token',
line 2476 CURLOPT_URL => 'https://api.usps.com/oauth2/v3/revoke',

Note that each of the "apis" in the URL became "api" instead.

You will still get a "revocation" error in the module but this should allow it to function.

10 Aug 2025, 2:50 PM
#131
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,969
Plugin Contributions:
8

Re: USPS Shipping (RESTful) (USPSr)

retched:

Sorry for the late AM response... I may have found it.

Can you try (and this is a bit crude) replacing all https://apis.usps.com to https://apis.usps.com.

In short: make this change on the following:

  • On or about line 2197
  • On or about line 2270
  • On or about line 2271
  • On or about line 2397
  • On or about line 2472

For a total of 5 changes in all.

It seems the USPS did a change to the endpoint URI and didn't announce it (or I somehow missed it). Once you confirm this, I will start making an emergency patch.

ripe for a refactor.

put the endpoint in a private var, and then use the var when constructing your URLs.

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

10 Aug 2025, 6:26 PM
#132
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)

carlwhat:

ripe for a refactor.

put the endpoint in a private var, and then use the var when constructing your URLs.

best.

Yup that's going to be the way going forward. Didn't expect them to make such a change.

10 Aug 2025, 7:56 PM
#133
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

that did not work, i used find and replace all instances of apis.usps.com to api.usps.com
now getting this USPSr Error: Unable to obtain bearer token. Check to make sure that you entered valid API Credentials and that those credentials have permission to access the API. Check your settings.
on top page of shipping modules in admin here is log
2025-08-10 19:48:11:
Requesting Token from USPS
Token Request
{
"grant_type": "client_credentials",
"client_id": "SXCWDtDCb4nPB3BWrXlQYK21KYdng0thqQUJcwAr69SqtUVw",
"scope": "domestic-prices addresses international-prices service-standards shipments"
}

2025-08-10 19:48:12:

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 -

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

10 Aug 2025, 8:04 PM
#134
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

i may have figured it out, it only works when a customer is logged in

10 Aug 2025, 8:06 PM
#135
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

original file works as it was, how do we let this run when not logged in

10 Aug 2025, 8:09 PM
#136
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

but transit day delay still not saving

10 Aug 2025, 9:35 PM
#137
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)

jimmie:

i may have figured it out, it only works when a customer is logged in

That's somewhat not expected behavior. If a customer has not entered a mailing address into the shipping estimator (either by way of being logged and visiting that page or providing at least a Zip code), the USPS quotes will not appear. (The API doesn't know where to estimate shipping to.) In that event, no error message will be displayed and instead no quotes from USPS will be displayed.

10 Aug 2025, 9:37 PM
#138
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)

jimmie:

that did not work, i used find and replace all instances of apis.usps.com to api.usps.com
now getting this USPSr Error: Unable to obtain bearer token. Check to make sure that you entered valid API Credentials and that those credentials have permission to access the API. Check your settings.
on top page of shipping modules in admin here is log
2025-08-10 19:48:11:
Requesting Token from USPS
Token Request
{
"grant_type": "client_credentials",
"client_id": "SXCWDtDCb4nPB3BWrXlQYK21KYdng0thqQUJcwAr69SqtUVw",
"scope": "domestic-prices addresses international-prices service-standards shipments"
}

2025-08-10 19:48:12:

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 -

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

Did you activate the Consumer Key by visiting the COP panel? It's a weird step that USPS insists upon doing. You need to visit the following page and enter the Consumer Key (not secret) at this page: https://cop.usps.com/navigator?wf=apionboarding&callback=https:%2F%2Fdeveloper.usps.com

10 Aug 2025, 9:41 PM
#140
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

retched:

Did you activate the Consumer Key by visiting the COP panel? It's a weird step that USPS insists upon doing. You need to visit the following page and enter the Consumer Key (not secret) at this page: https://cop.usps.com/navigator?wf=apionboarding&callback=https:%2F%2Fdeveloper.usps.com

yes i did, it is working , but only when logged in