I've an issue with braintree api integration and having an issue with generating the token from api, but it's showing an error- "Class 'App\Controller\Braintree\ClientToken' not found".
I've adding the Braintree library in webroot directory and include by- require_once('braincard\includes\braintree_init.php');
I'm generating the braintree token with following function. Braintree\ClientToken::generate();
Regards
By simply using Braintree\ClientToken::generate();
, you are indicating that it is relative to the current namespace, which is \App\Controller. Try \Braintree\ClientToken::generate();
instead, this should work.
You might also investigate how you can use Composer to move the library to a move "Cake-ish" folder (having it in the webroot
sounds like a potential security hole), and autoload the class without needing to resort to require_once
or the like.