URGENT HELP - PHP Web Payments. Unirest/Request not found

I’ve upgraded my site to PHP 8, and my web payments are throwing errors of:

PHP Fatal error: Uncaught Error: Class "Unirest\Request" not found in /home/customer/www/mysite.com/public_html/vendor/square/square/src/Apis/BaseApi.php:63

Everything is up to date with Composer. The full stacktrace is:

Stack trace: #0 /home/customer/www/thesite.com/public_html/vendor/square/square/src/Apis/LocationsApi.php(23): Square\Apis\BaseApi->__construct(Object(Square\SquareClient), Array, NULL) #1 /home/customer/www/thesite.com/public_html/vendor/square/square/src/SquareClient.php(553): Square\Apis\LocationsApi->__construct(Object(Square\SquareClient), Array, NULL) #2 /home/customer/www/thesite.com/public_html/includes/location-info.php(46): Square\SquareClient->getLocationsApi() #3 /home/customer/www/thesite.com/public_html/includes/location-info.php(60): LocationInfo->__construct() #4 /home/customer/www/thesite.com/public_html/payment_pay.php(11): require('/home/customer/...') #5 {main} thrown in /home/customer/www/thesite.com/public_html/vendor/square/square/src/Apis/BaseApi.php on line 63

The code in location-info.php is:

` $location = $this->square_client->getLocationsApi()->retrieveLocation($dotenv[‘SQUARE_LOCATION_ID’])->getResult()->getLocation();’

The location ID (SQUARE_LOCATION_ID) is being pulled through correctly.

Any ideas from anyone?

Ben

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Square Developer
Locations API
Using the Square PHP SDK

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

The error message indicates that the Unirest\Request class is not found. This could be due to the Unirest PHP library not being properly installed or included in your project.

The Square PHP SDK uses the Unirest library for making HTTP requests. If you’re using Composer for dependency management, it should automatically install and include Unirest when you require the Square SDK.

Please ensure that you have run composer install in your project directory to install all necessary dependencies. If you have done this and are still encountering the issue, it might be worth checking your composer.json file to ensure that the Unirest library is included as a dependency.

If you’re not using Composer, you’ll need to manually include the Unirest library in your project. You can download it from the Unirest GitHub repository and include it in your project manually.

This answer was reviewed by @Bryan-Square.

Everything was working on the older version of the SDK I had in place.

I ran a straight up composer update, and everything fell apart, after everything (including unirest) was updated.