Building Square Payment within IBM Domino's Java environment... but can't even get SquareClient started correctly

Hello! I’m trying to build a simple payment-processing agent within HCL Domino (formerly IBM Domino & Lotus Domino before that). I’m stumbling on the fairly simple step of building the SquareClient using SquareClient.Builder(), and I think it’s partly to do with the fact that Domino’s Java environment is different from most others.

I should quickly add: I come to Java development from the more Javascript-centric world of browsers and Node.js, so I recognize I’m at something of a disadvantage when it comes to general awareness of the ecosystem, where to find missing dependency libraries, understanding what an error stack-trace says, etc. so whenever I see instructions about Maven or Gradle it’s not obvious to me how that maps to the Java environment in Domino.

Back to my specific problem: I’ve managed to get as far as writing my Java agent to field a “nonce” parameter from an embedded Square payment form, so with this, my application’s Square app ID, location ID and a determined numeric value to be charged I should be able to invoke a SquareClient attached to my Square app’s sandbox and use that to build a PaymentRequest.

But I’m not able to get that far. The code I’m running is much like the sample code I’ve seen on the Square pages for the Java SDK:

System.out.println("Just about to build the SquareClient...");
try {
	SquareClient squareClient = new SquareClient.Builder()
	System.out.println("SquareClient built; next we'll fetch the Right Information...");

I fully expect to see “SquareClient built…” in my server’s console log but instead I get this:

11:45:17 AM  HTTP JVM: Just about to build the SquareClient...
11:45:17 AM  HTTP JVM: Exception in thread "AgentThread: JavaAgent" 
11:45:17 AM  HTTP JVM: java.lang.NoClassDefFoundError: kotlin.TypeCastException
11:45:17 AM  HTTP JVM:  at com.squareup.square.http.client.OkClient.getDefaultOkHttpClient(
11:45:17 AM  HTTP JVM:  at com.squareup.square.http.client.OkClient.<init>(
11:45:17 AM  HTTP JVM:  at com.squareup.square.SquareClient$
11:45:17 AM  HTTP JVM:  at JavaAgent.NotesMain(Unknown Source)
11:45:17 AM  HTTP JVM:  at lotus.domino.AgentBase.runNotes(Unknown Source)
11:45:17 AM  HTTP JVM:  at Source)
11:45:17 AM  HTTP JVM: Caused by: 
11:45:17 AM  HTTP JVM: java.lang.ClassNotFoundException: kotlin.TypeCastException
11:45:17 AM  HTTP JVM:  at lotus.domino.AgentLoader.loadClass(Unknown Source)
11:45:17 AM  HTTP JVM:  at java.lang.ClassLoader.loadClass(

I’m using the latest build of the Square Java SDK (, and in an attempt to resolve a number of dependency errors I initially saw I’ve also downloaded & added JARs for OKHTTP (ver. 4.8.1) and OKIO (ver. 2.8.0). I know for a fact that the current Domino server I’m working on uses Java 8, and the IDE I’m using (Domino Designer) is set to build to Java 8.

So my first question is this: what versions of OKHTTP and OKIO does Square Java SDK require? Are the versions I’m using appropriate?

Am I missing one or more other dependencies? I can see there’s a “kotlin.TypeCastException” error that looks to be the most proximate cause of the error above; do I need to include some form of Kotlin helper library to use in my agent?

My apologies for the long post. Does anyone have any insight they can offer, and/or does anyone have any experience developing Square apps within Domino?

Thanks in advance for any assistance.

Apologies for the late reply. You can find all the dependencies of the SDK here:, which would be downloaded automatically if you used something like Maven. I do see 3.12.1 for okhttp, but I do not see OKIO listed (although it might be a dependency of okhttp). You can see all the dependencies in the above file, though.

I’m also not familiar with Domino at all, so I can’t really speak to that unfortunately.