Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Provide customer ephemeral key is called twice #8837

Open
ncapitelli opened this issue Jul 22, 2024 · 0 comments
Open

[BUG] Provide customer ephemeral key is called twice #8837

ncapitelli opened this issue Jul 22, 2024 · 0 comments
Labels

Comments

@ncapitelli
Copy link

Summary

When the CustomerSheet component is launched, the customerEphemeralKeyProvider callback gets triggered twice, even though the component is only launched once. This happens because LaunchedEffect(Unit) and remember are used, preventing its reinitialization.

Code to reproduce

@Composable
@OptIn(ExperimentalCustomerSheetApi::class)
fun WalletBottomSheet(state: WalletState) {
    val customerSheet = rememberCustomerSheet(
        configuration = CustomerSheet
            .Configuration
            .builder(merchantDisplayName = state.merchantName)
            .googlePayEnabled(state.displayGooglePay)
            .build(),
        customerAdapter = CustomerAdapter.create(
            context = LocalContext.current,
            customerEphemeralKeyProvider = {
                println("It's called twice")
                state.customerEphemeralKeyProvider.provideCustomerEphemeralKey()
            },
            setupIntentClientSecretProvider = null,
        ),
        callback = state.onResult,
    )

    LaunchedEffect(Unit) {
        customerSheet.present()
    }
}

Android version

All versions are impacted

Impacted devices

All devices are impacted

Installation method

Installation using gradle dependency

Dependency Versions

kotlin: 1.9.24
stripe-android: 20.48.0
Android Gradle Plugin:
Gradle: 8.7

SDK classes

Video

Other information

@ncapitelli ncapitelli added the bug label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant