C# Other
Latest commit 39e8aa5 Jul 26, 2018
Permalink
Failed to load latest commit information.
.github 3.9.0 Sep 14, 2017
src/Braintree 4.5.0 Jul 26, 2018
test 4.5.0 Jul 26, 2018
.gitignore 3.9.0 Sep 14, 2017
ACKNOWLEDGEMENTS.md 3.1.0 Nov 10, 2016
Braintree.sln 4.0.0 Mar 23, 2018
CHANGELOG.md 4.5.0 Jul 26, 2018
DEVELOPMENT.md 4.0.0 Mar 23, 2018
Dockerfile-core 4.0.0 Mar 23, 2018
Dockerfile-core2 4.0.0 Mar 23, 2018
Dockerfile-mono 4.0.0 Mar 23, 2018
LICENSE 3.13.0 Mar 13, 2018
Makefile 4.0.0 Mar 23, 2018
README.md 4.2.0 Apr 30, 2018
Rakefile 4.0.0 Mar 23, 2018

README.md

Braintree .NET library

The Braintree .NET library provides integration access to the Braintree Gateway.

Please Note

The Payment Card Industry (PCI) Council has mandated that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, Braintree is updating its services to require TLS 1.2 for all HTTPS connections. Braintree will also require HTTP/1.1 for all connections. Please see our technical documentation for more information.

Dependencies

  • .NET Core 1.0, .NET Core 2.0, or .NET Framework 4.5.2+

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 = 1000.00M,
                PaymentMethodNonce = nonceFromTheClient,
                Options = new TransactionOptionsRequest
                {
                    SubmitForSettlement = true
                }
            };

            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

Developing and Tests

See DEVELOPMENT.md.

License

See the LICENSE file.