Java SDK SquareClient.Builder() fails with jackson no such method error

Trying to run the example Java SDK code and I cannot create/build a SquareClient. It gives me a runtime exception. I also can’t seem to find any Java SDK example (not android) where I can create a simple checkout call. The Github repo I found says the checkout API is deprecated. Going back to the Square documentation, it is very vague on exactly how to set up a payment using the Java SDK. I’m using a springboot webapp and I’d like the payment REST call to happen on the server side, not in javascript, but I can’t seem to get a working example of this. The code I found expects me to create a SquareClient first, but that fails. However, even if that worked, I don’t have an example of what a payment process request would look like.

I’m using Evironment.SANDBOX and my own sandbox access token, testing locally on localhost.

Does anyone know what might be the problem or perhaps there’s a complete Java example I can reference instead?

Here’s my maven dependency and then the code and error below. My code already includes jackson but perhaps there’s a version incompatibility?

        <dependency>
            <groupId>com.squareup</groupId>
            <artifactId>square</artifactId>
            <version>28.0.0.20230419</version>
            <scope>compile</scope>
        </dependency>


 SquareClient client = new SquareClient.Builder()
                .accessToken(setupData.getPropertySquareAccessToken())
                .environment(getEnvironment())
                .build();


java.lang.NoSuchMethodError: 'com.fasterxml.jackson.databind.cfg.MapperBuilder com.fasterxml.jackson.databind.json.JsonMapper$Builder.withConfigOverride(java.lang.Class, java.util.function.Consumer)'
	at io.apimatic.core.utilities.CoreHelper.<clinit>(CoreHelper.java:94) ~[core-0.4.2.jar:na]
	at io.apimatic.core.GlobalConfiguration.<init>(GlobalConfiguration.java:93) ~[core-0.4.2.jar:na]
	at io.apimatic.core.GlobalConfiguration.<init>(GlobalConfiguration.java:19) ~[core-0.4.2.jar:na]
	at io.apimatic.core.GlobalConfiguration$Builder.build(GlobalConfiguration.java:301) ~[core-0.4.2.jar:na]
	at com.squareup.square.SquareClient.<init>(SquareClient.java:242) ~[square-28.0.0.20230419.jar:na]
	at com.squareup.square.SquareClient.<init>(SquareClient.java:103) ~[square-28.0.0.20230419.jar:na]
	at com.squareup.square.SquareClient$Builder.build(SquareClient.java:929) ~[square-28.0.0.20230419.jar:na]

We have a simple Java example that uses the Web Payments SDK and Payment API to make the server side call to process the payment. Otherwise you are correct the example that uses the Checkout API is the deprecated Checkout API example. The team is working on updating that. :slightly_smiling_face:

Thank you, I’m looking at this now.