bradleyboy / laravel-braintree by bradleyboy

Package Data
Maintainer Username: bradleyboy
Maintainer Contact: (Brad Daily)
Package Create Date: 2013-09-08
Package Last Update: 2016-08-12
Language: PHP
License: Unknown
Last Refreshed: 2024-05-15 15:06:37
Package Statistics
Total Downloads: 44,366
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 22
Total Watchers: 3
Total Forks: 28
Total Open Issues: 2

Note: This package is no longer maintained, use oureastudios/laravel5-braintree instead.

Braintree for Laravel 4


In your Laravel project's composer.json file, add laravel-braintree as a dependency in the require object:

"bradleyboy/laravel-braintree": "dev-master"

You do not need to add any other dependencies, as laravel-braintree loads in the other dependencies automatically.

Finally, do a composer update.

Once installed, add the ServiceProvider to your provider array within app/config/app.php:

'providers' => array(




To publish a boilerplate configuration file, run:

php artisan config:publish bradleyboy/laravel-braintree

Then open app/config/packages/bradleyboy/laravel-braintree/braintree.php to setup your environment and keys:


return array(
	'environment'             => 'sandbox',
	'merchantId'              => 'my-merchant-id',
	'publicKey'               => 'my-public-key',
	'privateKey'              => 'my-private-key',
	'clientSideEncryptionKey' => 'my-client-side-encryption-key',

You can setup different environmental configurations by creating matching folders inside the app/config/packages/bradleyboy/laravel-braintree directory. For instance, if you have a local environment, add a config file at app/config/packages/bradleyboy/laravel-braintree/local/braintree.php for that environment.


Once setup, you can use the Braintree PHP classes as spelled out in the documentation.


If you are using braintree.js, you can easily output your client side encryption key in your Blade views:

<script type="text/javascript" src=""></script>
<script type="text/javascript">
    var braintree = Braintree.create("@braintreeClientSideEncryptionKey");


Thanks to the Abodeo/laravel-stripe package, as I used it as a starting point.