Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 平衡支付错误中的致命错误_Php_Json_Balanced Payments - Fatal编程技术网

Php 平衡支付错误中的致命错误

Php 平衡支付错误中的致命错误,php,json,balanced-payments,Php,Json,Balanced Payments,我最近实施了平衡支付。我已经更新了composer.json文件,但在运行PHP时出现以下错误: PHP消息:PHP致命错误: 中的未捕获异常“平衡\错误\错误” /app/vendor/balanced/balanced/src/balanced/Errors/Error.php:42“ 我在命令行上运行了以下命令,它说依赖项都已更新: composer update My composer.json如下所示: { "require" : { "braintree/braintree_p

我最近实施了平衡支付。我已经更新了composer.json文件,但在运行PHP时出现以下错误:

PHP消息:PHP致命错误:

中的未捕获异常“平衡\错误\错误” /app/vendor/balanced/balanced/src/balanced/Errors/Error.php:42“

我在命令行上运行了以下命令,它说依赖项都已更新:

composer update
My composer.json如下所示:

{
 "require" : {
 "braintree/braintree_php" : "2.28.0",
 "balanced/balanced" : "1.*"
  }
} 
我的PHP如下所示:

<?php

  #BALANCED
 require(__DIR__ . '/vendor/autoload.php');

  Httpful\Bootstrap::init();
  RESTful\Bootstrap::init();
  Balanced\Bootstrap::init();

   Balanced\Settings::$api_key = "ak-test-*************************";

  $amount = $_POST["amount"];
  $href = $_POST["href"];

 $bank_account = Balanced\BankAccount::get($href);
 $bank_account->credits->create(array(
     "amount" => $amount
   ));

API返回的响应抛出了一个可捕获的错误。我建议您将代码包装在try/catch中,并确定API错误是什么。一些快速常见的猜测,可能是任意数量的,
$amount
$href
为空,或者
$amount
不是以整数表示的数量

此外,在集成平衡API时,您会发现通过平衡仪表板访问日志非常有用