# Php\_payment example - stuck on ApiHelper error

**URL:** <https://developer.squareup.com/forums/t/php-payment-example-stuck-on-apihelper-error/7922>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [December 12, 2022, 10:59pm UTC](https://developer.squareup.com/forums/t/php-payment-example-stuck-on-apihelper-error/7922 "2022-12-12T22:59:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsack](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bsack](https://developer.squareup.com/forums/u/bsack)\
**Post date:** [December 12, 2022, 10:59pm UTC](https://developer.squareup.com/forums/t/php-payment-example-stuck-on-apihelper-error/7922/1 "2022-12-12T22:59:52Z")

</div>

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](https://github.com/square/connect-api-examples/tree/master/connect-examples/v2/php_payment)

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

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [December 12, 2022, 11:52pm UTC](https://developer.squareup.com/forums/t/php-payment-example-stuck-on-apihelper-error/7922/2 "2022-12-12T23:52:25Z")

</div>

Hmm, it should work as long as you followed all the setup steps in the README.md. Can you confirm that you did everything? 🙂

---

<div class="post-metadata">

**Author:** ![BrianC](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/brianc/32/112_2.png) [@BrianC](https://developer.squareup.com/forums/u/BrianC)\
**Post date:** [December 13, 2022, 4:14am UTC](https://developer.squareup.com/forums/t/php-payment-example-stuck-on-apihelper-error/7922/3 "2022-12-13T04:14:44Z")

</div>

What version of PHP are you running? It requires 7.2+ which I think ‘composer update’ enforces?

---

<div class="post-metadata">

**Author:** ![bsack](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bsack](https://developer.squareup.com/forums/u/bsack)\
**Post date:** [December 13, 2022, 2:09pm UTC](https://developer.squareup.com/forums/t/php-payment-example-stuck-on-apihelper-error/7922/4 "2022-12-13T14:09:21Z")

</div>

we have PHP Version 7.4.33 on a linux server.

---

<div class="post-metadata">

**Author:** ![bsack](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bsack](https://developer.squareup.com/forums/u/bsack)\
**Post date:** [December 13, 2022, 8:05pm UTC](https://developer.squareup.com/forums/t/php-payment-example-stuck-on-apihelper-error/7922/5 "2022-12-13T20:05:06Z")

</div>

Still a mystery - i did a local installation, ran the local php dev server, and it worked. just uploaded all of that to our webserver, wiping out my original experiment, and now it works on the server, too.

could have been some dotenv weirdness? i don’t know.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [December 13, 2022, 8:35pm UTC](https://developer.squareup.com/forums/t/php-payment-example-stuck-on-apihelper-error/7922/6 "2022-12-13T20:35:32Z")

</div>

Wow! Glad to hear you got it to work. 🙂
