A few things:
- Please do not share your access token with anyone; I’ve removed it but that’s a big security concern.
- No where in your code have you set the sandbox host domain, which is why you’re seeing this error (you’re using sandbox access token + location id but hitting production urls).
- You would need to do something like
\SquareConnect\Configuration::getDefaultConfiguration()->setHost("https://connect.squareupsandbox.com");
to fix the error. - You’re using a very outdated (and deprecated SDK); you probably want to also migrate to our new SDK at some point: GitHub - square/square-php-sdk: PHP client library for the Square API
- Our examples do use the new Payments API and new SDK, so I’m not sure where you got the deprecated code from: connect-api-examples/connect-examples/v2/php_payment at master · square/connect-api-examples · GitHub
Please let me know if you have additional questions or concerns!