FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
115 stars 19 forks source link

Race Conditions Making All Stripe Payments That Require 3D Authentication to Fail on All Platforms in Production #3637

Open danielphiri opened 1 month ago

danielphiri commented 1 month ago

Can we access your project?

Current Behavior

When a Stripe payment is attempted that requires 3D authentication, they fail, on all platforms. This works fine in test mode, but once Stripe is in production, they all fail. This also happens for all payment cards that I tried (Visa, Mastercard and Discover). What happens from a UX standpoint on iOS is that when the user has entered their payment details, there's an embedded web view that pops up and directs the user to a Stripe "authentication" page. This page just briefly shows the logo of the card processing company and then a loading indicator shows for a few seconds before the page says that the authentication was successful. No user input is requested from the user during this authentication process. However, the only way to dismiss this web view is by clicking the "Close" button at the top left of the screen. But immediately after the authentication web view has been dismissed, the Stripe payment page says the authentication has failed. On other platforms such as web (for all web browsers, Safari, Chrome, etc), the authentication page doesn't event show. The payments just immediately fail if they require 3D authentication. This is a very big issue that has so far cost my company a lot of money and lost a lot of clients.

I ran a session on a simulator on Xcode to try and find the cause of the issue, and it looks like this is being caused by a race condition. Here's a summary of the logs that were returned by Xcode from initializing the payment, to the payment failure:

LOG ANALYTICS: mc_complete_init_customer - [(key: "session_id", value: ""), (key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "mpe_config", value: ["billing_details_collection_configuration": ["attach_defaults": false, "email": "automatic", "phone": "automatic", "address": "automatic", "name": "automatic"], "appearance": ["usage": true, "colors": true, "primary_button": true, "shadow": false, "font": false, "corner_radius": false, "border_width": false], "style": 0, "preferred_networks": "", "return_url": false, "allows_delayed_payment_methods": false, "apple_pay_config": false, "save_payment_method_opt_in_behavior": "automatic", "customer": true, "default_billing_details": false]), (key: "locale", value: "en_US"), (key: "is_development", value: true), (key: "is_decoupled", value: false), (key: "apple_pay_enabled", value: 1)]
LOG ANALYTICS: mc_load_started - [(key: "session_id", value: ""), (key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "locale", value: "en_US"), (key: "is_development", value: true), (key: "is_decoupled", value: false), (key: "apple_pay_enabled", value: 1)]
LOG ANALYTICS: mc_load_succeeded - [(key: "session_id", value: ""), (key: "selected_lpm", value: "card"), (key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "locale", value: "en_US"), (key: "is_development", value: true), (key: "is_decoupled", value: false), (key: "duration", value: 0.6301209926605225), (key: "apple_pay_enabled", value: 1)]
LOG ANALYTICS: mc_complete_sheet_savedpm_show - [(key: "session_id", value: ""), (key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "locale", value: "en_US"), (key: "link_enabled", value: false), (key: "is_development", value: true), (key: "is_decoupled", value: false), (key: "currency", value: "zmw"), (key: "apple_pay_enabled", value: 1), (key: "active_link_session", value: false)]
LOG ANALYTICS: mc_confirm_button_tapped - [(key: "session_id", value: ""), (key: "selected_lpm", value: "card"), (key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "locale", value: "en_US"), (key: "is_development", value: true), (key: "is_decoupled", value: false), (key: "apple_pay_enabled", value: 1)]
LOG ANALYTICS: stripeios.payment_intent_confirmation - [(key: "source_type", value: "unknown"), (key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "company_name", value: "Lani"), (key: "apple_pay_enabled", value: 1)]
LOG ANALYTICS: stripeios.3ds2_authenticate - [(key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "intent_id", value: ""), (key: "company_name", value: "Lani"), (key: "apple_pay_enabled", value: 1)]
LOG ANALYTICS: stripeios.url_redirect_next_action - [(key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "intent_id", value: ""), (key: "company_name", value: "Lani"), (key: "apple_pay_enabled", value: 1)]
-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID
10.25.0 - [FirebaseCrashlytics][I-CLS000000] Crashlytics skipped rotating the Install ID during urgent mode because it is run on the main thread, which can't succeed. This can happen if the app crashed the last run and Crashlytics is uploading urgently.
10.25.0 - [FirebaseCrashlytics][I-CLS000000] Crashlytics skipped rotating the Install ID during urgent mode because it is run on the main thread, which can't succeed. This can happen if the app crashed the last run and Crashlytics is uploading urgently.
10.25.0 - [FirebaseCrashlytics][I-CLS000000] Crashlytics skipped rotating the Install ID during urgent mode because it is run on the main thread, which can't succeed. This can happen if the app crashed the last run and Crashlytics is uploading urgently.
LOG ANALYTICS: mc_complete_payment_savedpm_failure - [(key: "session_id", value: ""), (key: "selected_lpm", value: "card"), (key: "pay_var", value: "legacy"), (key: "ocr_type", value: "none"), (key: "locale", value: "en_US"), (key: "link_session_type", value: "shared"), (key: "link_enabled", value: false), (key: "is_development", value: true), (key: "is_decoupled", value: false), (key: "error_message", value: "STPPaymentHandlerErrorDomain, 6"), (key: "duration", value: 20.9), (key: "currency", value: "zmw"), (key: "apple_pay_enabled", value: 1), (key: "active_link_session", value: false)]
10.25.0 - [FirebaseCrashlytics][I-CLS000000] Crashlytics skipped rotating the Install ID during urgent mode because it is run on the main thread, which can't succeed. This can happen if the app crashed the last run and Crashlytics is uploading urgently.
10.25.0 - [FirebaseCrashlytics][I-CLS000000] Crashlytics skipped rotating the Install ID during urgent mode because it is run on the main thread, which can't succeed. This can happen if the app crashed the last run and Crashlytics is uploading urgently.
10.25.0 - [FirebaseAnalytics][I-ACS023104] Number of real-time events is over the real-time event count daily limit. Event is no longer real-time. Event name, parameters: _ae, {
"_o" = clx;
"_sc" = FlutterViewController;
"_si" = 3312390374362535485;
"_sn" = event;
fatal = 1;
timestamp = 0;
}
10.25.0 - [FirebaseAnalytics][I-ACS023104] Number of real-time events is over the real-time event count daily limit. Event is no longer real-time. Event name, parameters: _ae, {
"_o" = clx;
"_sc" = FlutterViewController;
"_si" = 3312390374362535485;
"_sn" = event;
fatal = 1;
timestamp = 0;
}

Expected Behavior

The payments were expected to go through successfully. All the cards I used to simulate are legitimate cards with all the necessary funds and I've never had any other issues with them on any other platform before or after experiencing this issue on the platform. There are also numerous failures from users, in the past month no payments have gone through, they have all failed due to this issue.

Steps to Reproduce

  1. Create any page that can process a Stripe payment
  2. Add an amount to pay that's above the minimum for Stripe payments
  3. Pay using a card that requires 3D authentication. This is very important. Any card that doesn't require 3D authentication would be of no use. Also please make sure that you're in production
  4. The payment will fail

Reproducible from Blank

Bug Report Code (Required)

ITESjPLlvI9gruFc+6qAYflQhQAkH1x/bZJEl9caRRQjIqLpEZkQO+r+VGBuYbCZd1A7GlCkmlge/9b6uOHDIcICCw6uaINo1ZZyZQHwdz+WVLqbDbuoeEBAAdFmFU+OyMG7mBBBBMV2dGw8w2z/cq3qNleeY8aSfxBlZ7vfcPo=

Visual documentation

https://github.com/user-attachments/assets/11bf86fb-ae51-4fd4-b487-e236b5ce012f

Environment

- FlutterFlow version: v4.1.82 released August 6, 2024
- Platform: iOS, Android, Web
- Browser name and version: Safari, Chrome, latest versions on iOS 17.5.1
- Operating system and version affected: iOS, Android, latest versions

Additional Information

paulperez-dev commented 4 weeks ago

Hi @Danielphiri! So sorry you are facing this issue.

Logs are not showing a lot of info. Why do you think it's happening a race condition?

danielphiri commented 3 weeks ago

@paulperez-dev what kind of information is missing from the logs? I removed all sensitive information from them, but the main information should be there from all the logs I observed around the bug. Sorry, I used the wrong term, I didn't think the issue was necessarily being caused by a race condition, but a thread violation. If you noticed, well over half of the logs after the last log that was related to the 3D authentication were thread violation warnings (i.e, LOG ANALYTICS: stripeios.url_redirect_next_action...)

danielphiri commented 3 weeks ago

@paulperez-dev you can also run the code on your simulator to see the logs directly. Unfortunately, Stripe is requiring 3D authentication on all transactions on my account, so all the payment requests are failing for all my users in production

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

danielphiri commented 2 weeks ago

This is really disappointing, you're really going to close the issue without even looking into it?

paulperez-dev commented 2 weeks ago

Hi @Danielphiri! I'm not saying there is missing info, but the logs do not provide much info to identify the issue. I'm not a Stripe expert so how can I validate that the warning is a thread violation? Is there any documentation link you can share?

danielphiri commented 2 weeks ago

The main point here is not that this is a thread violation, the point is that there is clearly a major bug that's blocking transactions. I have provided enough information for you and your team to try and reproduce the issue. You can also reproduce this with a project that you can set up from scratch.

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.