Skip to content

[BUG] PaymentSheet.FlowController: onPaymentOption is called multiple times (regression in v23.2.0) #12809

Description

@rdlabo

Summary

Hi, I'm the maintainer of @capacitor-community/stripe.

After upgrading to stripe-android v23.2.0, the onPaymentOption callback passed to PaymentSheet.FlowController.create() is invoked multiple times for a single user interaction.

Note: This does not occur in v23.1 and later versions.

What is blocked by this issue?

This causes duplicated events and inconsistent state handling in our Capacitor plugin.

Specifically:

Duplicate events are emitted to the JS layer
UI state may become inconsistent
Consumers need to add defensive logic to ignore duplicates

Code to reproduce

PaymentSheet.FlowController.create(
    activity,
    { paymentOption: PaymentOption? ->
        paymentFlowExecutor.onPaymentOption(
            bridge,
            paymentFlowCallbackId,
            paymentOption
        )
    },
    { result: PaymentSheetResult ->
        paymentFlowExecutor.onPaymentFlowResult(
            bridge,
            paymentFlowCallbackId,
            result
        )
    }
)

Result: onPaymentOption is invoked multiple times
Expected: onPaymentOption should be invoked exactly once per selection

Android version

ext {
    minSdkVersion = 26
    compileSdkVersion = 34
    targetSdkVersion = 34
    androidxActivityVersion = '1.8.0'
    androidxAppCompatVersion = '1.6.1'
    androidxCoordinatorLayoutVersion = '1.2.0'
    androidxCoreVersion = '1.12.0'
    androidxFragmentVersion = '1.6.2'
    coreSplashScreenVersion = '1.0.1'
    androidxWebkitVersion = '1.9.0'
    junitVersion = '4.13.2'
    androidxJunitVersion = '1.1.5'
    androidxEspressoCoreVersion = '3.5.1'
    cordovaAndroidVersion = '10.1.1'
}

Impacted devices

Use Google Pixel 8a

Installation method

gradle dependency

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions