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 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?