Zen Cart Logo
Forums / Addon Shipping Modules / UPS Shipping using RESTful/OAuth API [Support Thread]

UPS Shipping using RESTful/OAuth API [Support Thread]

Sticky

Views: 45,474

Results 21 to 40 of 220
27 Jun 2023, 9:19 PM
#21
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
370
Plugin Contributions:
0

UPS Shipping using RESTful/OAuth API [Support Thread]

Hi @lat9, unfortunately, I didn't turn on the debug option for this UPS...I used this plug-in in our live site for several days and no warning was received until now. It seems intermittent (I only received one warning), so maybe just a system glitch on my site.

I just turned it on and I will report if any updates.

28 Jun 2023, 8:52 PM
#22
bustin98 avatar

bustin98

New Zenner

Join Date:
Jul 2019
Location:
Norwalk, Ohio
Posts:
12
Plugin Contributions:
0

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

I am receiving a debug with the plugin:

[28-Jun-2023 16:38:03 America/New_York] Request URI: //modules.php?set=shipping&module=upsoauth, IP address: -------
#1 array_keys() called at [
\includes\classes\AdminNotifications.php:149]
#2 AdminNotifications->pruneSavedState() called at [*******\includes\classes\AdminNotifications.php:34]
#3 AdminNotifications->getNotifications() called at [
******\modules.php:59]
--> PHP Warning: array_keys() expects parameter 1 to be array, null given in ********\includes\classes\AdminNotifications.php on line 149.

[28-Jun-2023 16:38:03 America/New_York] Request URI: //modules.php?set=shipping&module=upsoauth, IP address: --------
#1 implode() called at [
\includes\classes\AdminNotifications.php:150]
#2 AdminNotifications->pruneSavedState() called at [\includes\classes\AdminNotifications.php:34]
#3 AdminNotifications->getNotifications() called at [
\modules.php:59]
--> PHP Warning: implode(): Invalid arguments passed in *******\includes\classes\AdminNotifications.php on line 150.

[28-Jun-2023 16:38:03 America/New_York] Request URI: /*******/modules.php?set=shipping&module=upsoauth, IP address: --------
#1 AdminNotifications->getNotifications() called at [********\modules.php:59]
--> PHP Warning: Invalid argument supplied for foreach() in *******\includes\classes\AdminNotifications.php on line 37.

Cart version 1.5.6b

29 Jun 2023, 3:13 AM
#23
lat9 avatar

lat9

Administrator

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

bustin98:

I am receiving a debug with the plugin:

[28-Jun-2023 16:38:03 America/New_York] Request URI: //modules.php?set=shipping&module=upsoauth, IP address: -------
#1 array_keys() called at [
\includes\classes\AdminNotifications.php:149]
#2 AdminNotifications->pruneSavedState() called at [*******\includes\classes\AdminNotifications.php:34]
#3 AdminNotifications->getNotifications() called at [
******\modules.php:59]
--> PHP Warning: array_keys() expects parameter 1 to be array, null given in ********\includes\classes\AdminNotifications.php on line 149.

[28-Jun-2023 16:38:03 America/New_York] Request URI: //modules.php?set=shipping&module=upsoauth, IP address: --------
#1 implode() called at [
\includes\classes\AdminNotifications.php:150]
#2 AdminNotifications->pruneSavedState() called at [\includes\classes\AdminNotifications.php:34]
#3 AdminNotifications->getNotifications() called at [
\modules.php:59]
--> PHP Warning: implode(): Invalid arguments passed in *******\includes\classes\AdminNotifications.php on line 150.

[28-Jun-2023 16:38:03 America/New_York] Request URI: /*******/modules.php?set=shipping&module=upsoauth, IP address: --------
#1 AdminNotifications->getNotifications() called at [********\modules.php:59]
--> PHP Warning: Invalid argument supplied for foreach() in *******\includes\classes\AdminNotifications.php on line 37.

Cart version 1.5.6b
Interesting ... but that's something between the 1.5.6b /admin/modules.php and the zen-cart.com notification server. I'll see what I can find out and report back.

29 Jun 2023, 3:36 AM
#24
lat9 avatar

lat9

Administrator

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

You might try editing your admin's /admin/includes/configure.php and adding the following statement:

define('PROJECT_NOTIFICATIONSERVER_URL', 'https://ping.zen-cart.com/api/notifications');

That sets the 'base' zen-cart notification server URL to the now-current version.

5 Jul 2023, 12:32 PM
#25
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,296
Plugin Contributions:
39

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

Having issues with this Zen Cart 1.5.8, OPC, Bootstrap & PHP 7.4

It will not pull a quote at all. UPS needs this

Thank you for your response. The request does not include the authentication information. Bearer Tokens are active for four hours. After the Bearer Token expire, a new one must be requested. Please provide the complete curl request with the Bearer Token.

I tested cURL

Connecting to UPS (port 80)...
GOOD: CURL Connection successful.

Connection Details:
Array
(
[url] => "https://onlinetools.ups.com/security/v1/oauth/token"
[content_type] => application/json
[http_code] => 400
[header_size] => 559
[request_size] => 192
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.215764
[namelookup_time] => 0.000177
[connect_time] => 0.008837
[pretransfer_time] => 0.02153
[size_upload] => 37
[size_download] => 91
[speed_download] => 421
[speed_upload] => 171
[download_content_length] => 91
[upload_content_length] => 37
[starttransfer_time] => 0.021535
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 104.114.165.227
[certinfo] => Array
(
)

[primary_port] => 443
[local_ip] => 67.43.13.48
[local_port] => 57472
[http_version] => 3
[protocol] => 2
[ssl_verifyresult] => 0
[scheme] => HTTPS
[appconnect_time_us] => 21228
[connect_time_us] => 8837
[namelookup_time_us] => 177
[pretransfer_time_us] => 21530
[redirect_time_us] => 0
[starttransfer_time_us] => 21535
[total_time_us] => 215764

)

Here is the log

2023-07-05 12:14:36: OAuth Token successfully retrieved, expires in 14396 seconds.
2023-07-05 12:14:36: Existing OAuth token is present.

2023-07-05 12:14:36: RAW Rate Request
{
"RateRequest": {
"Request": {
"TransactionReference": {
"CustomerContext": "CustomerContext",
"TransactionIdentifier": "TransactionIdentifier"
}
},
"PickupType": {
"Code": "03"
},
"CustomerClassification": {
"Code": "04"
},
"Shipment": {
"Shipper": {
"Address": {
"City": "Yardley",
"StateProvinceCode": "PA",
"PostalCode": "19067",
"CountryCode": "US"
}
},
"ShipTo": {
"Address": {
"City": "",
"StateProvinceCode": "",
"PostalCode": "",
"CountryCode": "US"
}
},
"DeliveryTimeInformation": {
"PackageBillType": "02"
},
"Package": [
{
"PackagingType": {
"Code": "02"
},
"PackageWeight": {
"UnitOfMeasurement": {
"Code": "LBS"
},
"Weight": "0.4"
},
"PackageServiceOptions": {
"DeclaredValue": {
"CurrencyCode": "USD",
"MonetaryValue": "155"
}
}
}
]
}
}
}

2023-07-05 12:14:37: {
"response": {
"errors": [
{
"code": "250002",
"message": "Invalid Authentication Information."
}
]
}
}
2023-07-05 12:14:41: Existing OAuth token is present.
2023-07-05 12:14:41: Existing OAuth token is present.

2023-07-05 12:14:41: RAW Rate Request
{
"RateRequest": {
"Request": {
"TransactionReference": {
"CustomerContext": "CustomerContext",
"TransactionIdentifier": "TransactionIdentifier"
}
},
"PickupType": {
"Code": "03"
},
"CustomerClassification": {
"Code": "04"
},
"Shipment": {
"Shipper": {
"Address": {
"City": "Yardley",
"StateProvinceCode": "PA",
"PostalCode": "19067",
"CountryCode": "US"
}
},
"ShipTo": {
"Address": {
"City": "",
"StateProvinceCode": "",
"PostalCode": "",
"CountryCode": "US"
}
},
"DeliveryTimeInformation": {
"PackageBillType": "02"
},
"Package": [
{
"PackagingType": {
"Code": "02"
},
"PackageWeight": {
"UnitOfMeasurement": {
"Code": "LBS"
},
"Weight": "0.4"
},
"PackageServiceOptions": {
"DeclaredValue": {
"CurrencyCode": "USD",
"MonetaryValue": "5"
}
}
}
]
}
}
}

2023-07-05 12:14:41: {
"response": {
"errors": [
{
"code": "250002",
"message": "Invalid Authentication Information."
}
]
}
}
2023-07-05 12:14:48: Existing OAuth token is present.
2023-07-05 12:14:48: Existing OAuth token is present.

2023-07-05 12:14:48: RAW Rate Request
{
"RateRequest": {
"Request": {
"TransactionReference": {
"CustomerContext": "CustomerContext",
"TransactionIdentifier": "TransactionIdentifier"
}
},
"PickupType": {
"Code": "03"
},
"CustomerClassification": {
"Code": "04"
},
"Shipment": {
"Shipper": {
"Address": {
"City": "Yardley",
"StateProvinceCode": "PA",
"PostalCode": "19067",
"CountryCode": "US"
}
},
"ShipTo": {
"Address": {
"City": "",
"StateProvinceCode": "GA",
"PostalCode": "31569",
"CountryCode": "US"
}
},
"DeliveryTimeInformation": {
"PackageBillType": "02"
},
"Package": [
{
"PackagingType": {
"Code": "02"
},
"PackageWeight": {
"UnitOfMeasurement": {
"Code": "LBS"
},
"Weight": "0.4"
},
"PackageServiceOptions": {
"DeclaredValue": {
"CurrencyCode": "USD",
"MonetaryValue": "5"
}
}
}
]
}
}
}

2023-07-05 12:14:48: {
"response": {
"errors": [
{
"code": "250002",
"message": "Invalid Authentication Information."
}
]
}
}
2023-07-05 12:21:35: Existing OAuth token is present.
2023-07-05 12:21:35: Existing OAuth token is present.

2023-07-05 12:21:35: RAW Rate Request
{
"RateRequest": {
"Request": {
"TransactionReference": {
"CustomerContext": "CustomerContext",
"TransactionIdentifier": "TransactionIdentifier"
}
},
"PickupType": {
"Code": "03"
},
"CustomerClassification": {
"Code": "04"
},
"Shipment": {
"Shipper": {
"Address": {
"City": "Yardley",
"StateProvinceCode": "PA",
"PostalCode": "19067",
"CountryCode": "US"
}
},
"ShipTo": {
"Address": {
"City": "",
"StateProvinceCode": "GA",
"PostalCode": "31569",
"CountryCode": "US"
}
},
"DeliveryTimeInformation": {
"PackageBillType": "02"
},
"Package": [
{
"PackagingType": {
"Code": "02"
},
"PackageWeight": {
"UnitOfMeasurement": {
"Code": "LBS"
},
"Weight": "0.4"
},
"PackageServiceOptions": {
"DeclaredValue": {
"CurrencyCode": "USD",
"MonetaryValue": "5"
}
}
}
]
}
}
}

2023-07-05 12:21:36: {
"response": {
"errors": [
{
"code": "250002",
"message": "Invalid Authentication Information."
}
]
}
}

PRO-Webs, Inc. since 2003 https://pro-webs.net/

5 Jul 2023, 12:44 PM
#26
lat9 avatar

lat9

Administrator

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

@mprough, did you add the "Rating API" permission to your UPS 'app' (found the answer on stackoverflow). From that article:

To add the Rating API, login to your developer account and go to your Apps page at

[https://developer.ups.com/apps?loc=en_US

](https://developer.ups.com/apps?loc=en_US)Then edit your app and add the Rating API.

5 Jul 2023, 5:30 PM
#27
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,296
Plugin Contributions:
39

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

The UPS support seems pretty mixed up with this new system, but they are now troubleshooting it on their end. I'll post what they find =)

PRO-Webs, Inc. since 2003 https://pro-webs.net/

7 Jul 2023, 1:29 PM
#28
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,296
Plugin Contributions:
39

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

mprough:

The UPS support seems pretty mixed up with this new system, but they are now troubleshooting it on their end. I'll post what they find =)

Thank you for your response. Based on the information provided, the Rating API product is not added to your Oauth credentials. Please complete the following steps:

  1. Browse to https://developer.ups.com/.

  2. Click the Profile icon and log into ups.com.

  3. Click the Profile icon and select Apps.

This will take you to the My Apps page. All Apps that you have created will be listed on this page.

  1. Click the app name link.

  2. Click Add Products.

  3. Select the product or products you want to add to your credentials.

  4. Click Save.

PRO-Webs, Inc. since 2003 https://pro-webs.net/

7 Jul 2023, 3:01 PM
#29
lat9 avatar

lat9

Administrator

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

mprough:

Thank you for your response. Based on the information provided, the Rating API product is not added to your Oauth credentials. Please complete the following steps:

  1. Browse to https://developer.ups.com/.

  2. Click the Profile icon and log into ups.com.

  3. Click the Profile icon and select Apps.

This will take you to the My Apps page. All Apps that you have created will be listed on this page.

  1. Click the app name link.

  2. Click Add Products.

  3. Select the product or products you want to add to your credentials.

  4. Click Save.
    Hmm, I thought that I'd covered that in this wiki article: https://github.com/lat9/upsoauth/wiki/Creating-Your-OAuth-Client-ID-and-Client-Secret

7 Jul 2023, 4:05 PM
#30
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,296
Plugin Contributions:
39

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

lat9:

Hmm, I thought that I'd covered that in this wiki article: https://github.com/lat9/upsoauth/wiki/Creating-Your-OAuth-Client-ID-and-Client-Secret

Well the client was setting it up, not me.... I wanted to make sure I posted the answer.

PRO-Webs, Inc. since 2003 https://pro-webs.net/

7 Jul 2023, 4:23 PM
#31
lat9 avatar

lat9

Administrator

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

mprough:

Well the client was setting it up, not me.... I wanted to make sure I posted the answer.
Thanks, Melanie, for the post-back!

20 Jul 2023, 10:04 PM
#32
lat9 avatar

lat9

Administrator

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

v1.1.0 of the upsoauth shipping module is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2374

This version contains changes associated with the following GitHub issues:

#4: Add missing shipping_ups.gif icon.
#5: Split API portion from shipping-module processing to promote code re-use.
#6: Add notification to allow site-specific processing to disable the module.
#7: Correct PHP warning on an empty response from UPS.
#11: Add notifications to enable additional configuration settings to be installed/removed/displayed.

Note: This version will automatically upgrade from v1.0.0!

2 Aug 2023, 6:04 PM
#33
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

If you are a developer setting this up on a client's behalf, you may be asked to authenticate - you either need the client's PIN and email address for their account, or a recent Invoice.

I have done this a few times without being asked to authenticate, but this time my luck ran out. :(

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

25 Aug 2023, 9:13 PM
#34
zippkits avatar

zippkits

New Zenner

Join Date:
Dec 2010
Location:
Central Indiana
Posts:
36
Plugin Contributions:
0

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

Installed and the site breaks at the shipping page.
V1.5.5b

Seems to break at the shipping page if the address is IN the selected zone. If I select a zone that doesn't include this address (or, select an address outside of selected zone), the page works, but no UPS shows.

Will not work with shipping zone blank.

Checked and double checked Client ID and Secret.

Help?

25 Aug 2023, 9:31 PM
#35
dbltoe avatar

dbltoe

Totally Zenned

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

If you are not seeing the whole page, take a look at https://docs.zen-cart.com/user/troubleshooting/blank_page/

You should also have some log files in the logs directory. If so, add them here using the # above.

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

25 Aug 2023, 11:56 PM
#36
zippkits avatar

zippkits

New Zenner

Join Date:
Dec 2010
Location:
Central Indiana
Posts:
36
Plugin Contributions:
0

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

Error:
PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/private/public_html/includes/modules/shipping/upsoauth/UpsOAuthApi.php on line 394

26 Aug 2023, 12:20 AM
#37
carlwhat avatar

carlwhat

zennedOut

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

Zippkits:

Error:
PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/private/public_html/includes/modules/shipping/upsoauth/UpsOAuthApi.php on line 394

i think there is a problem with the versions with which this software is compatible.

i am guessing that the issue you are having is because you are running a php version less than 7.4. line 394 defines a return type for which support only started in php 7.4. and zc 155 looks to be only compatible up to php 7.1.

the code base is not that big that one could remove all of the return types.

look at this image:

https://www.dropbox.com/scl/fi/2f1tmkraoe3oydq93vp8y/Screenshot-from-2023-08-25-17-15-43.png?rlkey=mxjyeu3v8dqc5d9wjqy7bn1nx&dl=0

you need to eliminate the colon (:) and the words 'array', 'string', and 'bool' on all of those line numbers, starting at 394.

that is my best guess as to your problem.

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.

26 Aug 2023, 1:27 AM
#38
zippkits avatar

zippkits

New Zenner

Join Date:
Dec 2010
Location:
Central Indiana
Posts:
36
Plugin Contributions:
0

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

Thanks so much for the responses!

26 Aug 2023, 1:18 PM
#39
lat9 avatar

lat9

Administrator

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

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

Ditto! Thanks for the report, @Zippkits, and the cause/solution, @carlwhat.

I've opened a GitHub issue (https://github.com/lat9/upsoauth/issues/15) to correct this in the next release.

29 Sep 2023, 3:15 PM
#40
arj3090 avatar

arj3090

New Zenner

Join Date:
Dec 2018
Location:
Orangeburg, SC
Posts:
7
Plugin Contributions:
0

Re: UPS Shipping using RESTful/OAuth API [Support Thread]

I have been struggling with getting this to work. When trying to checkout, I get these messages:

"Your available shipping options have changed. Please re-select your desired shipping method."

"This is currently the only shipping method available to use on this order."

Can anyone give me any insight?

ZenCart 1.5.6