I am new, new to development, new to square. This may be a silly question so forgive me for my ignorance. I keep getting the following error. I am using VS code and have run in my terminal the following co:
set SQUARE_ACCESS_TOKEN={my access token}
I replaced my access token with the one on the developer dashboard under the sandbox option. Yet the following error keeps happening. Am I to set my access token somewhere in the vscode separately? If so, where? What am I missing to make the connection? I feel like I am following the steps in the quickstart guide but to no avail.
I appreciate any help that you can provide on this matter. I feel as though once I am able to establish a connection I will be able to run with this but as of right now, I am pulling my hair out.
Fatal error : Uncaught TypeError: Square\BearerAuthManager::__construct(): Argument #1 ($accessToken) must be of type string, bool given, called in C:\xampp\htdocs\HAFHS\vendor\square\square\src\SquareClient.php on line 120 and defined in C:\xampp\htdocs\HAFHS\vendor\square\square\src\BearerAuthManager.php:21 Stack trace: #0 C:\xampp\htdocs\HAFHS\vendor\square\square\src\SquareClient.php(120): Square\BearerAuthManager->__construct(false) #1 C:\xampp\htdocs\HAFHS\quickstart.php(9): Square\SquareClient->__construct(Array) #2 {main} thrown in C:\xampp\htdocs\HAFHS\vendor\square\square\src\BearerAuthManager.php on line 21
Thank you for your question. Yes I was able to install Composer in the same directory of my application. Both the composer.json and composer.lock files are listed within the Explorer window of my project. Within the terminal I ran the "set SQUARE_ACCESS_TOKEN = " with the access token from my application dashboard.
Is there some other location or reason why I would be getting this error that you can think of?
Unfortunately, I receive no better results. I am sure that I am missing something here but when placing the set SQUARE_ACCESS_TOKEN="MySandboxAcessToken, it show that there are No Matching Commands. I am using “Ctrl+Shift+P” to bring up the command prompt and enter the command there however it doesn’t recognize it at a viable command. Any help is much appreciated.
The “echo” statement is a PHP built-in function. You use it like:
echo “debug output: $variable\n”;
inside your .php file. I’m not 100% sure whether the other Bryan was suggesting you type that line into a VScode command prompt or into the file, either way it will probably need a closing double quote mark, just in case that helps!