getCheckoutApi() Error Message

How do we resolve the following error message?

Uncaught Error: Call to a member function getCheckoutApi() on null in …

Do you have more of the error message or the body of the request so we can take a closer look? :slightly_smiling_face:

As requested, you may refer to the following error. I’ve tried solving this matter to no avail. for several hours.

We are not able to receive payments from our clients to-date because of the migration from SqPaymentForm to Web Payments SDK.

We are using the Web Payments SDK PHP project that Lance from the Square Web Development team provided. [PHP Payment Example Project] connect-api-examples/connect-examples/v2/php_payment at master · square/connect-api-examples · GitHub


Fatal error : Uncaught TypeError: Square\ApiHelper::appendUrlWithTemplateParameters(): Argument #1 ($url) must be of type string, null given, called in /webroot/f/l/flocc001/ on line 304 and defined in /webroot/f/l/flocc001/ Stack trace: #0 /webroot/f/l/flocc001/ Square\ApiHelper::appendUrlWithTemplateParameters() #1 /webroot/f/l/flocc001/ Square\SquareClient->getBaseUri() #2 /webroot/f/l/flocc001/ Square\Apis\LocationsApi->retrieveLocation() #3 /webroot/f/l/flocc001/ LocationInfo->__construct() #4 /webroot/f/l/flocc001/ include(‘…’) #5 {main} thrown in /webroot/f/l/flocc001/ on line 47

It sounds like the SquareClient.php isn’t correctly configured. Were you first able to get it working by just following the :slightly_smiling_face:

We relaunched COMPOSER UPDATE and executed the following command line script.

php composer.phar install

After executing the above command line script, a Vendor folder was created with various dependencies (or other folders and files)

Please help!

Great! Did you then create a new file .env by copying the contents of the .env.example file and edit this file with your application credentials and environment configuration. WARNING : never save your credentials in your code. :slightly_smiling_face:

Yes, the .env file was updated accordingly or as directed.