Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

braintree .net client library

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 Braintree.Tests
Octocat-spinner-32 Braintree
Octocat-spinner-32 icons 2.6.0 August 19, 2010
Octocat-spinner-32 styles 2.6.0 August 19, 2010
Octocat-spinner-32 .gitignore 2.12.0 August 24, 2011
Octocat-spinner-32 Braintree.Tests.VisualState.xml braintree .net client library 1.0.0 February 23, 2010
Octocat-spinner-32 Braintree.Tests.nunit braintree .net client library 1.0.0 February 23, 2010
Octocat-spinner-32 Braintree.sln 2.15.1 April 19, 2012
Octocat-spinner-32 Braintree.sln.cache braintree .net client library 1.0.0 February 23, 2010
Octocat-spinner-32 CHANGELOG.md
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Thumbs.db 2.6.0 August 19, 2010
Octocat-spinner-32 braintree.shfbproj 2.4.0 June 24, 2010
README.md

Braintree .NET Client Library

The Braintree assembly provides integration access to the Braintree Gateway.

Dependencies

  • none

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"
            };

            TransactionRequest 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)
            {
                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
            {
                foreach (ValidationError error in result.Errors.DeepAll())
                {
                    Console.WriteLine("Attribute: " + error.Attribute);
                    Console.WriteLine("  Code: " + error.Code);
                    Console.WriteLine("  Message: " + error.Message);
                }
            }
        }
    }
}

Documentation

License

See the LICENSE file.

Something went wrong with that request. Please try again.