duangu4943 2018-09-15 13:57
浏览 125

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

I am going by the PHP Square Connect example here:

example

It appears to die at line 40:

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

I suspect my setup. Is there a way to check that you are actually communicating with the API properly?


More Info: I turned on php error reporting with

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

And now I get:

Notice: Undefined variable: location in my_path/st.php on line 283

and

Fatal error: Call to a member function getId() on null in my_path/st.php on line 283

Seems like a problem with either the API or the example. I had a similar problem with the Square Connect Example where it had bad lines:

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

  • 写回答

1条回答 默认 最新

  • dpqmu84646 2018-09-16 12:52
    关注

    OK, looks like this line was the problem:

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

    it should be:

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

    So getId is not required. That is how the example listed the line so my bad. Must have gotten that line from somewhere else on Git. Honestly, Square has the worst install/examples ever. Thanks.

    评论

报告相同问题?

悬赏问题

  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀