Paynow Java Class Thread Safety


I am using the Java SDK to send remote mobile payment requests. That requires creating a Paynow object as shown below:

Paynow paynow = new Paynow(“xxxx”, “yyyyyf”);

Q.1. My question is on the thread safety of the Paynow object. In other words can I create a single instance of Paynow object per class as shown above and use it to make multiple simultaneous calls from different threads?

Q.2. Do I need to create a new instance of Paynow for each call I make if the object is not thread safe? If I do so will that cause leaks. In fact as we speak I have my integration setup so that I create a new instance for every call. Something tells me that cant be right but it’s worked so far.

The second part of the question is based on the fact that my platform hosts multiple tenants / clients each of whom will have their own Integration ID and I guess API Key as well. And yet all the calls from my platform to the Payment Gateway will be made by the same platform.

Is there a way to share an API key (and maybe the integration ID too) for the different accounts / tenants / clients and still be able to send funds into the different bank accounts for my tenants?


After a bit of digging and a bit of nagging I was pointed to the GitHub repo for the Paynow SDK. There I found my answer which is that YES indeed the Paynow object is thread safe. Evidence this class description on this link


I hope that helps someone.

So now I am confidently creating one instance of Paynow for each integration (ID and KEY combination) and letting it roll with all payment requests for that integration.