### Quick Start: Braintree Gateway Transaction Sale Source: https://github.com/braintree/braintree_dotnet/blob/master/README.md This example demonstrates how to initialize the Braintree Gateway in sandbox mode and process a transaction sale using a payment method nonce. It includes error handling for successful transactions and various failure scenarios. ```csharp 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 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); } } } } } ``` -------------------------------- ### Build and Test with .NET CLI on Windows Source: https://github.com/braintree/braintree_dotnet/blob/master/DEVELOPMENT.md Restore dependencies, build the project, and run tests using the dotnet CLI on a Windows environment. ```bash dotnet restore dotnet build dotnet test . ``` -------------------------------- ### Build Docker Image with .NET Core 3.1 Source: https://github.com/braintree/braintree_dotnet/blob/master/DEVELOPMENT.md Use this command to build a Docker image with .NET Core 3.1 for development. ```bash make core3 ``` -------------------------------- ### Build Docker Image with Mono Source: https://github.com/braintree/braintree_dotnet/blob/master/DEVELOPMENT.md Use this command to build a Docker image that includes Mono for development. ```bash make mono ``` -------------------------------- ### Restore Dependencies for .NET Core 3.1 Tests Source: https://github.com/braintree/braintree_dotnet/blob/master/DEVELOPMENT.md Restore project dependencies before running tests on a Unix-like system with .NET Core 3.1. ```bash dotnet restore dotnet test . -f netcoreapp3.1 ``` -------------------------------- ### Conditional Compilation for Cross-Compatibility Source: https://github.com/braintree/braintree_dotnet/blob/master/DEVELOPMENT.md Use preprocessor directives to conditionally compile code for .NET Core and .NET Framework environments. Ensure methods are available in both target frameworks. ```csharp #if netcore NetCore.Method(); #else NetFramework.Method(); #end ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.