Braintree PHP Docs

We decided to build an app for the Node.js Knockout that will give us a head start on developing one of our most requested features: push notifications of gateway activity. Check out PushRelay and vote for us in the Node Knockout!

PHP Client Library

Download

braintree-php-2.5.0.tgz
SHA1: 643955290cfb44b91a44bdabdf6a499ebb8df6d9

Note: Requires PHP version 5.2 or higher

Updates

Current version: 2.5.0. Released August 19, 2010.

For details on what changed see the change log. If we deprecate any functionality we’ll add updating instructions to the deprecations page.

Fill out this form to receive an email when we release new updates.



Source Code

github | tgz | zip

Integration Examples

github | tgz | zip

Bugs

If you run into a bug, email us at support@getbraintree.com or create an issue on the github issue tracker.

Quick Start Example

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');

$result = Braintree_Transaction::sale(array(
    'amount' => '1000.00',
    'creditCard' => array(
        'number' => '5105105105105100',
        'expirationDate' => '05/12'
    )
));

if ($result->success) {
    print_r("success!: " . $result->transaction->id);
} else if ($result->transaction) {
    print_r("Error processing transaction:");
    print_r("\n  message: " . $result->message);
    print_r("\n  code: " . $result->transaction->processorResponseCode);
    print_r("\n  text: " . $result->transaction->processorResponseText);
} else {
    print_r("Message: " . $result->message);
    print_r("\nValidation errors: \n");
    print_r($result->errors->deepAll());
}