-1

I'm very new to Braintree and would appreciate probably a simple answer to something I've been stuck on for a while. I'm running Braintree with PHP on the server-side and I've got it working perfectly locally. However, when I move the same files to my web hosting server it doesn't seem to get the same result.

index.php

require_once 'vendors/braintree/Braintree.php';
$gateway = new Braintree_Gateway([
    'environment' => 'sandbox',
     'merchantId' => 'xxx',
     'publicKey' => 'xxx',
     'privateKey' => 'xxx'
]);

I get the following error:

PHP Fatal error: Uncaught Error: Class 'Braintree_Gateway' not found in ...

I'm guessing I need to do more than just simply use FTP to transfer the Braintree files to the server to install it. If so, how would I do that? Or if a web hosting server isn't the correct place to be hosting the Braintree Server what should I be looking?

Emma
  • 27,428
  • 11
  • 44
  • 69
Xirlas
  • 117
  • 1
  • 1
  • 11

1 Answers1

0

So after countless hours I've finally found the silly mistake that was being made.

Change the following code inside autoload.php:

 $fileName = dirname(__DIR__) . '/lib/';

To the directory that you have uploaded your Braintree files too.

Hopefully this helps someone in the future :)

Xirlas
  • 117
  • 1
  • 1
  • 11