Perl Client Library

Installation

cpan -i Net::Braintree

Supports Perl 5.8.3+

Updates

Current version: 0.3.3. Released February 01, 2012.

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

Fill out this form to receive emails when we release updates to the Perl library.



Source Code

github | tgz | zip

Integration Examples

None Yet

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

use Net::Braintree;

my $config = Net::Braintree->configuration;
$config->environment("sandbox");
$config->merchant_id("your_merchant_id");
$config->public_key("your_public_key");
$config->private_key("your_private_key");

my $result = Net::Braintree::Transaction->sale({
  amount => "1000.00",
  credit_card => {
    number => "5105510551055100",
    expiration_date => "05/12"
  }
});

if ($result->is_success) {
  printf "Transaction ID: %s", $result->transaction->id;
  # status will be authorized or submitted_for_settlement
  printf "Transaction Status: %s", $result->transaction->status;
} else {
  printf "Message: %s", $result->message;
  if !defined($result->transaction) {
    # validation errors prevented transaction from being created
    print $result->errors;
  } else {
    printf "Transaction ID: %s", $result->transaction->id;
    # status will be processor_declined, gateway_rejected, or failed
    printf "Transaction Status: %s", $result->transaction->status;
  }
}