Braintree .NET 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!

.NET Client Library

Download

Braintree-2.6.0.dll
SHA1: 5b6293a8f51f018be27a12f0010b01659dc752e9
Supports .NET Framework 2.0 and higher

Updates

Current version: 2.6.0. Released August 19, 2010.

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 .NET client library.



Source Code

github | tgz | zip

Integration Examples

github | tgz | zip

Importing Certificates

In rare cases, your server may not already be configured with the proper certificates. If you’re seeing SSL errors when attempting to connect, you can download the SecureTrust CA File and install it using documentation on how to add certificates from Microsoft.

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

using System;
using Braintree;

namespace BraintreeExample
{
    class Program
    {
        static void Main(string[] args)
        {
            var gateway = new BraintreeGateway
            {
                Environment = Braintree.Environment.SANDBOX,
                MerchantId = "the_merchant_id",
                PublicKey = "a_public_key",
                PrivateKey = "a_private_key"
            };

            var request = new TransactionRequest
            {
                Amount = 1000M,
                CreditCard = new CreditCardRequest
                {
                    Number = "4111111111111111",
                    ExpirationDate = "05/2012"
                }
            };

            Result<Transaction> result = gateway.Transaction.Sale(request);

            if (result.IsSuccess())
            {
                Transaction transaction = result.Target;
                Console.WriteLine("Success!: " + transaction.Id);
            }
            else if (result.Transaction != null)
            {
                Console.WriteLine("Message: " + result.Message);
                Transaction transaction = result.Transaction;
                Console.WriteLine("Error processing transaction:");
                Console.WriteLine("  Status: " + transaction.Status);
                Console.WriteLine("  Code: " + transaction.ProcessorResponseCode);
                Console.WriteLine("  Text: " + transaction.ProcessorResponseText);
            }
            else
            {
                Console.WriteLine("Message: " + result.Message);
                foreach (ValidationError error in result.Errors.DeepAll())
                {
                    Console.WriteLine("Attribute: " + error.Attribute);
                    Console.WriteLine("  Code: " + error.Code);
                    Console.WriteLine("  Message: " + error.Message);
                }
            }
        }
    }
}