I’m migrating to Web Payments SDK and trying to learn how by running the example found here: connect-api-examples/connect-examples/v2/php_payment at master · square/connect-api-examples · GitHub
I uploaded the code, ran the composer commands, made a .env file with our sandbox credentials in it, etc. In the error message below, in stack trace #2, it looks like the location is being retrieved correctly - i don’t understand what the problem could be. Has anyone seen this before? How did you fix it?
[12-Dec-2022 22:06:49 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Square\ApiHelper::appendUrlWithTemplateParameters() must be of the type string, null given, called in /home/<my_account>/public_html/php_payment/vendor/square/square/src/SquareClient.php on line 304 and defined in /home/<my_account>/public_html/php_payment/vendor/square/square/src/ApiHelper.php:47
Stack trace:
#0 /home/<my_account>/public_html/php_payment/vendor/square/square/src/SquareClient.php(304): Square\ApiHelper::appendUrlWithTemplateParameters(NULL, Array, false)
#1 /home/<my_account>/public_html/php_payment/vendor/square/square/src/Apis/LocationsApi.php(176): Square\SquareClient->getBaseUri()
#2 /home/<my_account>/public_html/php_payment/utils/location-info.php(31): Square\Apis\LocationsApi->retrieveLocation(‘DAW…’)
#3 /home/<my_account>/public_html/php_payment/utils/location-info.php(50): LocationInfo->__construct()
#4 /home/<my_account>/public_html/php_payment/index.php(10): include(‘/home/<my_account>/…’)
#5 {main}
thrown in /home/<my_account>/public_html/php_payment/vendor/square/square/src/ApiHelper.php on line 47