Php braintree integration

I am trying to integrate the Braintree API into my PHP application. I am new to payment gateway integration. Please help me with some sample code for the Braintree API.

+8
php integration payment-gateway braintree
source share
7 answers

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.

+11
source share

Braintree has full documentation on PHP integration: http://www.braintreepaymentsolutions.com/docs/php

+4
source share

You can register an account for the BrainTree sandbox at the following URL

http://www.braintreepayments.com/gateway/access-form

Once you get the sandboxed account, find the seller ID, public key and private key and put them in the .php configuration file.

Hope this helps you.

+3
source share

1) Sign up for a sandbox account https://www.braintreepayments.com/get-started

2) log in to your sandbox account https://sandbox.braintreegateway.com

3) In the top menu fiund 'Account' β†’ then the submenu "My user"

4), then on the page on the bot you will see the authorization Link API-keys

5) click the api keys link.

6) that's all ... Njoy

+3
source share

The main problem is that Braintree_Configuration is in a file called ... lib / braintree / configuration.php, so when PHP searches for it, it searches for a file called Braintree_Configuration.php and does not find ... / lib / Braintree / Configuration.php, so the examples do not work.

In my case, this may be due to Yii and as Yii links in debug files, but they still don't work ... looking for answers ...

+3
source share

OK In my case, I renamed the folder "lib" to "library". Then I spent a dozen minutes until I rename the folder name back to "lib", everything works again.

I can’t understand what kind of horse it is, it just works.

Basically, you just load the library from

https://developers.braintreepayments.com/start/hello-server/php

Do not touch anything, then everything will move.

+2
source share

The documentation available on the Braintree developer portal ( https://developers.braintreepayments.com/start/overview ) is awesome.

If you have any other questions and want to find a demo, please check it below.

http://www.ilovephp.net/php/simple-braintree-paypal-payment-gateway-integration-in-php-with-demo-examples/

If you want to integrate the Braintree API with support for 3D security, check out the link above.

+2
source share

All Articles