FoxPro Programming
Braintree
Gravatar is a globally recognized avatar based on your email address. Braintree
  barry taft
  All
  Mar 17, 2025 @ 05:18am

Has anyone interacted with PayPal's Braintree payment platform?

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  barry taft
  Mar 17, 2025 @ 06:43am

They have a sdk for dot net and i am thinking i can use dot net bridge in my solution

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Mar 17, 2025 @ 10:31am

Yes I use them for my payment processing and it’s been solid.

What’s nice is PayPal is part of the processing pipeline and processes like Cc cards, so no need for a separate PayPal integration.

You need to use their sdks and if using fox pro the .net sdk will work.

Rick

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Mar 17, 2025 @ 11:00am

Thanks Rick, The .Net SDK works for me. Could I use your Dot Net Bridge in my solution? Barry

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Mar 17, 2025 @ 03:56pm

Could I use your Dot Net Bridge in my solution?

Yes definitely.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Mar 17, 2025 @ 04:41pm

Is there another of your tools which would be better. Or if i hadn't asked would you have recommended a different tool?

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Mar 17, 2025 @ 04:58pm

Not sure what you mean?

I just told you I'm using BrainTree, and they have a pretty good API and you can use wwDotnetBridge to access their API.

Any CC interface you'll end up working with is going to require some sort of SDK, which most likely means you'll interface through .NET. Or - if available there services may also have REST Json Service interfaces, but frankly that'll be a lot more effort in many cases as you have to make sure you map all the structures properly. SDKs tend to be easier because they map defaults and have helpers to facilitate common scenarios via method calls.

I hear good things about Stripe's API, but for me personally I stuck with BrainTree primarily because it handles PayPal so seamlessly (and a large chunk of my transactions go through PayPal). pricing for all these services is pretty much the same (~3% plus small tx fee) unless you're big enough that you can negotiate rates.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Mar 17, 2025 @ 07:31pm

i was just wondering if one of your other products would be better than wwDotnetBridge for the integration. I am happy with wwDotnetBridge. sorry i should have clarified.

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  barry taft
  Mar 18, 2025 @ 08:02am

I will likely need some help with this so i have opted to get wwDotNetBridge by purchasing West Wind Client Tools. I have a c# certification for a project i did 14 years ago but haven't done an C# since then. Wish me luck.

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  barry taft
  Mar 20, 2025 @ 07:31am

do you have any source code that i could beg borrow purchase or steal?

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Mar 21, 2025 @ 09:14am

Sorry no.

FWIW - if you're going to be doing CC processing be aware that PCI (security) is a big issue you have to account for. If you're doing direct processing of cards from within an application via the API you'll need to be fully PCI compliant with audits and the whole nine yards.

In the past I'd done direct processing but ended up switching to the hosted solutions that providers have (BrainTree has one, Stripe has one, AuthNet has one etc.) These are basically hosted IFrame's that run on the provider's Web site so that the credit cards never touch your machine. All API calls then work with tokens that reference these transactions that are saved on the provider's servers.

Direct CC processing is something that is no longer an option for small companies IMHO due to the PCI requirements.

Just a heads up.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Mar 21, 2025 @ 11:44am

Thanks

My client has been using GlobalPay which has an XML interface over HTTP. Chilkat has been a godsend in that regard. But as you are aware Braintree does not.

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Mar 21, 2025 @ 12:59pm

Be careful with this: If you do this without PCI compliance, you're in violation of the Credit Card company contracts. If you get hacked for any reason you'll end up 100% liable for any losses incurred to customers. And the CC companies will come after you in that case to make the point.

Merchant Providers may not be strict but the underlying contracts with the CC companies are passed through as part of the contracts you sign with merchant providers. Larger companies like BrainTree, Stripe etc. require those PCI compliance audits on a yearly basis. If you use a hosted solution those are easy to pass with a self-assessment test (SAQ) (although they still do server scans for ports etc.).


FWIW, I believe BrainTree also has a REST API as do most other providers, but they tend to be a lot more work than the SDKs because you have to translate values and provide defaults that are otherwise provided by the SDKs. Behind the scenes the SDKs use an API anyway so the SDKs are just front ends for all of this.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Mar 22, 2025 @ 07:04am

Thanks Rick for both of those "Heads Up".

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  barry taft
  Mar 22, 2025 @ 10:55am

can you comment, in order to settle payments with BT SDK and wwDotNetBridge, can i invoke functions of their SDK "as is" or will i need to create a separate project wrapper around their functions like their sample:

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);
                }
            }
        }
    }
}
Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Mar 22, 2025 @ 09:55pm

Yes I think you can access the functionality directly I believe. But they are using a lot of Interfaces and explicitly virtual properties which may require explicit GetProperty()/SetProperty() calls instead of direct access...

If you can break down the functionality into into one or a few logical methods with a few parameters or a single object parameter of values to pass in, it might be a lot easier to do a wrapper in .NET. If for nothing else that you get the Intellisense to find all of what you need, and easier access to using enums and values without the intrinsic methods (GetProperty/SetProperty) you might have to call with FoxPro.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Apr 10, 2025 @ 06:39am

I installed Braintree .Net SDK using NuGet Package Manager console. https://developer.paypal.com/braintree/docs/start/hello-server/dotnet#or-use-nuget I am using the Quick Start Example from your Braintree GitHub profile: https://github.com/braintree/braintree_dotnet/tree/master I am getting the exception shown below:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Braintree, Version=5.31.0.0, Culture=neutral, PublicKeyToken=31b586f34d3e96c7' or one of its dependencies. This appears to be a known issue.

I am having difficulty seeing how the assembly could have a mismatched public key token in light of how it was installed.

Braintree doesn't seem to know what the solution might be. Are you able to advise on this matter?

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Apr 10, 2025 @ 09:25am

Works for me:

Clear
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = GetwwDotnetBridge()

? loBridge.LoadAssembly("braintree.dll")

loGateway = loBridge.CreateInstance("Braintree.BraintreeGateway")
? loGateway.ToString()   && valid

loGateway.MerchantId = "123123"
loGateway.PublicKey = "3123123"
loGateway.PrivateKey = "123123"

? loGateway.MerchantId

Make sure you:

  • Reference the .NET 4.x package not .NET Core (otherwise you'll need a bunch of dependencies)
  • Make sure you put it in the same folder as the Newtonsoft.Json.dll (ie. the wwDotnetBridge base folder). If you're using the open source version of wwDotnetBridge you need to pull down the Newtonsoft.Json NuGet package. If you're using a West Wind product that will already be present.

Read this post:

Especially the second part on how to figure out how to find the dependencies you actually need to run one or multiple components.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Apr 10, 2025 @ 09:44am

thank you so very much!

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  barry taft
  Apr 15, 2025 @ 11:44am

i have gotten the latest and greatest from Newtonsoft via the Nueget PM console. I assume to use Netstandard2.0. You concur?

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Apr 15, 2025 @ 08:18pm

No you want net452 for BrainTree and net45 for the NewtonSoft library to avoid those extra dependencies. Newtonsoft.Json is already provided by Web Connection/West Wind Client tools. If you're using the OSS version of wwDotnetBridge only then you'll need that package too.

I recommend you use the approach I mentioned earlier to create a console app in .NET and add the NuGet package, then see what the exact output is and copy those assemblies into your root folder.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Apr 17, 2025 @ 08:59am

Thanks I was able to load my first assembly. Is there a wwDotnetBridge.chm?

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Apr 17, 2025 @ 03:30pm

No. Docs online only...

If you're starting from scratch and you haven't used it before I'd recommend reading the White Paper or the recent Revised Session notes. It's long, but it reading it will help you write code more effectively with it. Many things are not obvious if the simple stuff doesn't work out of the gate (ie. direct COM access of objects).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Apr 18, 2025 @ 08:39am

I have/ am reading the white paper. Is this only in the version that comes with WW Client tools?: InitializeDotnetVersion

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  Rick Strahl
  barry taft
  Apr 18, 2025 @ 12:32pm

Why would you say that? Look at the code - it's in there in wwDotnetBridge.prg.

That said, this is isn't really necessary any more since .NET always runs .NET 4 these days as .NET 2.0 is no longer a thing that comes up and 4.x is the default and there won't be any newer versions (for full framework). The main purpose of this is to load the runtime before the app starts so that if there's any problem it occurs right at startup.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Apr 18, 2025 @ 03:58pm

I'm just working my way through the online documentation as well as the white paper. i don't find it. perhaps i have an old copy? or perhaps the online docs need a tweek? I don't mean to offend.

Gravatar is a globally recognized avatar based on your email address. re: Braintree
  barry taft
  Rick Strahl
  Apr 21, 2025 @ 05:07am

thanks for that.

© 1996-2025