Unhandled timeout exception in Flutter SDK

Hey there. I have a kind of question/bug report. I’m currently using the latest Square SDK for Flutter platform. I’m facing a strange/inconsistency behavior from the SDK when handling connection issues in the iOS side (I haven’t tested Android though, it may have the exactly same problem).

I do expect that, when the payment fails due to poor or none network conditions, the onApplePayNonceRequestFailure is invoked with the network issue immediately. The issue that I’m facing is that, it’s somehow “cached” and invoked later alongside other callback. Since this issue is very difficult to explain, I recorded a demo showing how to reproduce the problem.

I believe this is an issue in the Square iOS SDK, since the Flutter SDK is just a bridge for both (iOS & Android) SDKs.

To reproduce the issue, I downloaded Flutter SDK example in the official Square Github (GitHub - square/in-app-payments-flutter-plugin: Flutter Plugin for Square In-App Payments SDK) and added my Square application id to it.

Here’s the video demo reproducing the issue: Square Bug - YouTube

In the video you can see that I’m using Apple’s Network Link Conditioner to simulate a 100% loss network connection situation. I turn on 100% loss before trying to make the first payment, expecting that it fails for non existing network connection. But what happens instead, is that Apple sheet is dismissed but onApplePayNonceRequestFailure is not invoked for some reason. After that, I turn on network again and try to perform the payment again. Now, with network connection, the onApplePayNonceRequestFailure is triggered twice: the first invocation contains the network issue that should be invoked in the previous payment request, and the second one contains the correct issue. As you may notice, in the UI two error prompts are raised, because both failure callbacks are invoked together.

It seems that the first network connection issue is cached and not sent to the onApplePayNonceRequestFailure callback for some reason. This is leading to bizarre inconsistent behaviors in my app, because some users are facing timeout situations and after retrying, are seeing an error dialog (because this network issue is invoked alongside the success callback as well).

I would appreciate some help from the SDK maintainers to figure out what’s happening.

It has been almost two weeks since I opened this issue. Is this going to be addressed someday? What’s the current status?

Sorry for the delay. The team is working on a fix for this. I’ll be sure to reach out with any updates. :slightly_smiling_face:

1 Like