I've recently implemented Balanced Payments. I've updated my composer.json file and yet I get this error when running the PHP:
PHP message: PHP Fatal error:
Uncaught exception 'Balanced\Errors\Error' in /app/vendor/balanced/balanced/src/Balanced/Errors/Error.php:42"
I ran the following on the command line, and it says dependencies were all updated:
composer update
My composer.json looks like this:
{
"require" : {
"braintree/braintree_php" : "2.28.0",
"balanced/balanced" : "1.*"
}
}
My PHP is as follows:
<?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
));
The API returned a response that threw a catchable Error. I suggest you wrap the code in a try/catch and determine what the API error was. A few quick common guesses, as it could be any number of things, $amount
or $href
is null, or $amount
was not the amount expressed as an integer.
Also, you'll find logs accessible via the Balanced Dashboard to be very helpful as you integrate the Balanced API.