Here is the code you will need to start:
require_once 'PATH_TO_BRAINTREE/lib/Braintree.php'; Braintree_Configuration::environment('sandbox'); Braintree_Configuration::merchantId('your_merchant_id'); Braintree_Configuration::publicKey('your_public_key'); Braintree_Configuration::privateKey('your_private_key');
You can find your seller ID, public key and private key when logging into your sandbox account by looking at the Account menu in the upper right corner by clicking "My User" and then "API Keys". In fact, you can simply select "PHP" from the drop-down list of the language, and then the "Copy" button to correctly fill in the above code with your credentials.
After that, I would recommend trying to create a simple transaction to make sure everything works for you. Take a look at the quick launch example in PHP documents in Braintree and see if you can run this code (after replacing Braintree_Configuration and the required lines) to get a successful deal.
If you can get this code to work, I would either go over to your own integration, or you can take a look at this PHP application to get a better idea of ββwhat the full integration might look like.
If you're still having problems, feel free to contact Braintree support. The support team responds quickly and may even contact the developer if you have additional technical questions.
Benmills
source share