Intermittent API Timeout with Square Java SDK

Hi Square Team,

Our project is integrated with the Square Java SDK, and we’ve configured the request timeout to 20 seconds.

During runtime, we occasionally encounter exceptions where a Square API call exceeds the 20-second timeout and gets forcibly terminated. These incidents occur roughly once every few days.

What’s strange is that the same API calls typically complete in under 1 second under normal conditions. Could you help us understand what might be causing these intermittent timeouts? Are there known issues or recommended practices for handling such scenarios?

Additionally, we’ve implemented the retry mechanism as recommended by the SDK, but it does not seem to take effect when the request hits the 20-second timeout. Is this expected behavior, or is there something we may have missed in configuring retries?

We’d really appreciate your guidance on both the timeout and the retry behavior.

Best regards,
Murphy

Requests can vary for a multitude of reasons. Any transient issue can cause a delay with the request. :slight_smile:

Thank you for your response!

I understand that request behavior can vary due to a number of factors. When this issue occurs, is it possible to rely on the Square Java SDK’s automatic retry mechanism to handle such cases?

If so, could you please advise on how to properly configure the Java SDK’s HttpClient to enable and control retry behavior (e.g., max retries, retry conditions, etc.)?

Your guidance would be greatly appreciated.

Best regards,
Murphy

The SDK retry behavior is already pre configured. You shouldn’t need to adjust anything in SDK unless there is a business need for an adjustment. :slight_smile:

Thank you for your response.
If I encounter the same issue again in the future, I will create a new topic to follow up.

Best regards,
Murphy