title: Getting Braintree client token using PHP?
body: <p>I'm following Braintree's instructions to create a client token using <a href="https://developers.braintreepayments.com/android+php/start/hello-server#provide-a-client-token-to-your-client" rel="nofollow">this page</a>.</p>
  
  <p>I made a Sandbox Account. Then, I downloaded the PHP library. The file downloaded as <code>braintree-php-2.37.0.tgz</code>, which I unzipped.</p>
  
  <p>Then, using Eclipse for PHP Developers and following <a href="http://www.eclipse.org/pdt/help/html/adding_a_php_library.htm" rel="nofollow">these directions</a>, I:</p>
  
  <ul>
  <li>went to <code>Eclipse</code>, then <code>Preferences...</code>, then <code>PHP</code>, then <code>Libraries</code>, then <code>New...</code></li>
  <li>made a new library called <code>braintree</code></li>
  <li>chose <code>Add External folder...</code> and added the <code>braintree-php-2.37.0</code> folder which I had earlier unzipped.</li>
  <li>went to the <code>Properties</code> of the app I'm working on</li>
  <li>went to <code>PHP</code>, then <code>Include Path</code>, then <code>Libraries</code>, then <code>Add Library...</code></li>
  <li>then chose <code>User Library</code> and clicked <code>Next &gt;</code>, then selected <code>braintree</code> (which I had just made) and clicked <code>Finish</code></li>
  <li>finalized by clicking <code>OK</code></li>
  </ul>
  
  <p>After I've done all of the above, I see that within the project's <code>PHP Include Path</code> folder, <code>braintree</code> is present with <code>Braintree.php</code> and all.</p>
  
  <p>I then continued with the first set of instructions and my PHP file basically looks like this:</p>
  
  <pre><code>Braintree_Configuration::environment('sandbox');
  Braintree_Configuration::merchantId('&lt;my_merchant_id&gt;');
  Braintree_Configuration::publicKey('&lt;my_public_key&gt;');
  Braintree_Configuration::privateKey('&lt;my_private_key&gt;');
  
  $clientToken = Braintree_ClientToken::generate();
  </code></pre>
  
  <p>But nothing happens. It seems like the code won't even get past <code>Braintree_Configuration::environment('sandbox');</code>.</p>
  
  <p>I see in many places that <code>require_once 'PATH_TO_BRAINTREE/lib/Braintree.php';</code> is included but I don't know how to write the path to the Braintree.php file. I added the actual path which leads to where I downloaded the Braintree folder, but that didn't help at all. And I'm also further confused because I figured that Braintree.php is already added as a library.</p>
  
  <p>I'm also using Google App Engine and uploading my PHP code to their server. I'm not sure if this is part of the problem or not.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I took the unzipped folder (<code>braintree-php-2.37.0</code>) and copied it into the PHP folder so it could be uploaded to Google App Engine as well.</p>
  
  <p>I then edited my PHP code to be this: </p>
  
  <pre><code>&lt;?php
  
  require_once('./braintree-php-2.37.0/lib/Braintree.php');
  
  Braintree_Configuration::environment('sandbox');
  Braintree_Configuration::merchantId('&lt;my_merchant_id&gt;');
  Braintree_Configuration::publicKey('&lt;my_public_key&gt;');
  Braintree_Configuration::privateKey('&lt;my_private_key&gt;');
  
  $clientToken = Braintree_ClientToken::generate();
  
  ?&gt;
  </code></pre>
  
  <p>The code now won't get past <code>require_once('./braintree-php-2.37.0/lib/Braintree.php');</code>.</p>