Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

einsteinpp's avatar

Error when using Braintree

Hello,

When using braintree with Spark I got an error (with Stripe everything work). I've followed the instruction in the documentation and when came the moment to install spark I used :

php artisan spark:install --force --braintree

The error:

ErrorException (E_ERROR)
(View: /home/vagrant/code/my-project/resources/views/vendor/spark/layouts/app.blade.php) (View: /home/vagrant/code/my-project/resources/views/vendor/spark/layouts/app.blade.php)
/home/vagrant/code/my-project/vendor/braintree/braintree_php/lib/Braintree/Util.php

     * @throws Exception multiple types depending on the error
     * @return void
     */
    public static function throwStatusCodeException($statusCode, $message=null)
    {
        switch($statusCode) {
        case 401:
            throw new Exception\Authentication();
            break;
        case 403:
            throw new Exception\Authorization($message);
            break;
        case 404:
            throw new Exception\NotFound();
            break;
        case 426:
            throw new Exception\UpgradeRequired();
            break;
        case 429:
            throw new Exception\TooManyRequests();
            break;
        case 500:
            throw new Exception\ServerError();
            break;
        case 503:
            throw new Exception\DownForMaintenance();
            break;
        default:
            throw new Exception\Unexpected('Unexpected HTTP_RESPONSE #' . $statusCode);
            break;
        }

" (View: /home/vagrant/code/my-project/resources/views/vendor/spark/layouts/app.blade.php) (View: /home/vagrant/code/my-project/resources/views/vendor/spark/layouts/app.blade.php) ◀"

(screen) https://cl.ly/nMwD

The line 59 is this one :

throw new Exception\Authorization($message);

I've setup my .env file to use my key etc ... (at first I got an error because of that).

Any help is appreciate.

0 likes
0 replies

Please or to participate in this conversation.