如何确认您正在连接Square API - 示例脚本问题?

问题描述 投票:0回答:1

我将通过PHP Square Connect示例:

example

它似乎死在第40行:

$transactions_api = new \SquareConnect\Api\TransactionsApi();

我怀疑我的设置。有没有办法检查您是否正在与API正确通信?


更多信息:我打开了php错误报告

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

现在我得到:

注意:未定义的变量:第283行的my_path / st.php中的位置

致命错误:在第283行的my_path / st.php中调用null上的成员函数getId()

似乎是API或示例的问题。我在Square Connect示例中遇到了类似的问题:

Checkout API Setup Guide references commands that kill test pages AND do not exist in API

connect square
1个回答
0
投票

好的,看起来这一行是问题所在:

$result = $transactions_api->charge($location->getId(), $request_body);

它应该是:

$result = $transactions_api->charge($location_id, $request_body);

所以getId不是必需的。这就是这个例子列出的行所以我的坏。必须从Git上的其他地方获得该行。老实说,Square有史以来最糟糕的安装/例子。谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.