项目作者: braintree

项目描述 :
Braintree .NET library
高级语言: C#
项目地址: git://github.com/braintree/braintree_dotnet.git
创建时间: 2010-02-23T21:00:40Z
项目社区:https://github.com/braintree/braintree_dotnet

开源协议:MIT License

下载


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

  • The Braintree .NET library targets Net Framework 4.5.2 and Net Standard 2.0. It is tested against .NET Framework 4.5.2 (via Mono) and NET Core 3.1.

Versions

Braintree employs a deprecation policy for our SDKs. For more information on the statuses of an SDK check our developer docs.

Major version number Status Released Deprecated Unsupported
5.x.x Active August 2020 TBA TBA
4.x.x Inactive March 2018 August 2022 August 2023

Documentation

Updating from an Inactive, Deprecated, or Unsupported version of this SDK? Check our Migration Guide for tips.

Quick Start Example

  1. using System;
  2. using Braintree;
  3. namespace BraintreeExample
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var gateway = new BraintreeGateway
  10. {
  11. Environment = Braintree.Environment.SANDBOX,
  12. MerchantId = "the_merchant_id",
  13. PublicKey = "a_public_key",
  14. PrivateKey = "a_private_key"
  15. };
  16. TransactionRequest request = new TransactionRequest
  17. {
  18. Amount = 1000.00M,
  19. PaymentMethodNonce = nonceFromTheClient,
  20. Options = new TransactionOptionsRequest
  21. {
  22. SubmitForSettlement = true
  23. }
  24. };
  25. Result<Transaction> result = gateway.Transaction.Sale(request);
  26. if (result.IsSuccess())
  27. {
  28. Transaction transaction = result.Target;
  29. Console.WriteLine("Success!: " + transaction.Id);
  30. }
  31. else if (result.Transaction != null)
  32. {
  33. Transaction transaction = result.Transaction;
  34. Console.WriteLine("Error processing transaction:");
  35. Console.WriteLine(" Status: " + transaction.Status);
  36. Console.WriteLine(" Code: " + transaction.ProcessorResponseCode);
  37. Console.WriteLine(" Text: " + transaction.ProcessorResponseText);
  38. }
  39. else
  40. {
  41. foreach (ValidationError error in result.Errors.DeepAll())
  42. {
  43. Console.WriteLine("Attribute: " + error.Attribute);
  44. Console.WriteLine(" Code: " + error.Code);
  45. Console.WriteLine(" Message: " + error.Message);
  46. }
  47. }
  48. }
  49. }
  50. }

Developing and Tests

See DEVELOPMENT.md.

License

See the LICENSE file.