Is it safe to use the SquareClient as a static property

I have various methods that require the use of the SquareClient (.Net) from my API. Instead of setting up a new client on each request, is it safe to create a global static property which returns a single client and use this every time for all requests… I am also concerned about the possibilty of many open connections when using seperate instances, like the case with HttpClient as blogged here You’re using HttpClient wrong and it is destabilizing your software | ASP.NET Monsters
Can anyone advise the best approach?

Hi @craig welcome to the forums!

I certainly don’t see why not. Note, though, that if you intend on supporting more than 1 Square merchant (including yourself), that you’ll need to create a new SquareClient with the merchant’s access token each time you need to switch to accessing their account.

Ah, great advice Stephen! I will be supporting multiple merchants… so that’s settled then, I won’t be using static variables here. Thanks :slight_smile: