Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mschinis/braintree
Braintree is a Laravel package that contains a service provider for the official braintree v2.x API. Supports drop-in UI and comes with examples.
https://github.com/mschinis/braintree
Last synced: 5 days ago
JSON representation
Braintree is a Laravel package that contains a service provider for the official braintree v2.x API. Supports drop-in UI and comes with examples.
- Host: GitHub
- URL: https://github.com/mschinis/braintree
- Owner: mschinis
- Created: 2014-09-11T15:31:13.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-24T01:39:06.000Z (over 9 years ago)
- Last Synced: 2024-10-31T20:12:26.616Z (15 days ago)
- Language: PHP
- Homepage: https://packagist.org/packages/mschinis/braintree
- Size: 168 KB
- Stars: 4
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Braintree Package for Laravel 4.2
==============### Installation
In your Laravel project's composer.json file, add `braintree` as a dependency in the require object:
```js
"mschinis/braintree": "dev-master"
```Use `composer update` for composer to update the dependencies and download the package.
Once installed, add the ServiceProvider to your provider array within `app/config/app.php`:
```php
'providers' => array('Mschinis\Braintree\BraintreeServiceProvider'
)
```### Configuration
To publish the configuration file, run:
```shell
php artisan config:publish mschinis/braintree
```Then open `app/config/packages/mschinis/braintree/config.php` to setup your environment and keys:
Acceptable environment values are `sandbox` or `production`.
All required keys can be found by logging in to your [sandbox](https://sandbox.braintreegateway.com/login) or [production](https://www.braintreegateway.com/login) account```php
'sandbox',
'merchantId' => 'use_your_merchant_id',
'publicKey' => 'use_your_public_key',
'privateKey' => 'use_your_private_key',
'CSEKey' => 'use_your_client_side_encryption_key'
);
```You can setup different environmental configurations by creating matching folders inside the `app/config/packages/mschinis/braintree` directory. For instance, if you have a `local` environment, create a config file at `app/config/packages/mschinis/braintree/local/config.php` for that environment.
### Example
You can use the artisan command `php artisan braintree:example` to generate a boilerplate controller that will handle an example payment and an example view with a payment form.After you generate the files, make sure you add the controller to your routes: `Route::controller('braintree', "BraintreeController");`.
Once the steps above are completed, you can access the test page at `/braintree/test-page`
### Usage
Once setup, you can use the Braintree PHP classes as spelled out in the [documentation](https://developers.braintreepayments.com/javascript+php/start/overview).
Links to essential information:
* [Generating Client Tokens](https://developers.braintreepayments.com/javascript+php/sdk/overview/generate-client-token)
* [Drop-in UI](https://developers.braintreepayments.com/javascript+php/start/hello-client)
* [Transactions](https://developers.braintreepayments.com/javascript+php/sdk/server/transaction-processing/create)
* [Result & Error Handling](https://developers.braintreepayments.com/javascript+php/sdk/server/transaction-processing/result-handling)