stripe
                                
                                
                                
                                    stripe copied to clipboard
                            
                            
                            
                        Connection Token is not setted
Platform
- [ ] Web
 - [ ] iOS
 - [ X] Android
 
Describe the bug On iOS everything works great with tap to pay, but on Android it's currently not working because of the connection token over a custom provider is not setted and it comes to an following stacked error:
Uncaught (in promise) CapacitorException: Timed out waiting for connection token
    at returnResult (<anonymous>:943:32)
    at cap.fromNative (<anonymous>:925:17)
    at <anonymous>:1:18
CapacitorException: Unknown error retrieving payment intent from API
    at returnResult (<anonymous>:943:32)
    at cap.fromNative (<anonymous>:925:17)
    at <anonymous>:1:18
and sometimes it tries to set the connection token, but with the following error:
native StripeTerminal.setConnectionToken (#64254552)
result StripeTerminal.setConnectionToken (#64254552)
Uncaught (in promise) CapacitorException: Stripe Terminal do not pending fetchConnectionToken
    at returnResult (<anonymous>:943:32)
    at cap.fromNative (<anonymous>:
To Reproduce Steps to reproduce the behavior:
        await StripeTerminal.addListener(TerminalEventsEnum.RequestedConnectionToken, async () => {
            console.log('waiting for token')
            const response = await api.getStripeConnectionToken
            if (response.status !== 200) return
            await StripeTerminal.setConnectionToken({token: response.data.token});
        });
It's never emitted and yes i run it before the initializing progress.
After that i run:
                    await StripeTerminal.initialize({isTest: true})
                    await api.tapToPay.connect()
More code snippets:
                async start(paymentIntent: string) {
                    if (!apiStore.isTerminalConnected && !apiStore.isTerminalConnecting) {
                        await api.tapToPay.connect()
                    }
                    try {
                        // Collect payment intent
                        await StripeTerminal.collectPaymentMethod({paymentIntent: paymentIntent});
                        try {
                            // Process and confirm payment intent
                            await StripeTerminal.confirmPaymentIntent();
                        } catch (e) {
                            console.error("Error on confirm payment intent", e);
                            await api.tapToPay.disconnect()
                            return {status: 'canceled', errorMessage: e}
                        }
                        await api.tapToPay.disconnect()
                        return {status: 'succeeded', errorMessage: null}
                    } catch (e) {
                        await api.tapToPay.disconnect()
                        console.error(e)
                        return {status: 'aborted', errorMessage: e}
                    }
                },
                async connect() {
                    if(apiStore.isTerminalConnecting){
                        return
                    }
                    apiStore.setTerminalConnectedState(false)
                    if(apiStore.getStripeLocationId.length === 0)
                        await api.auth.getTapToPayDetails()
                    await StripeTerminal.disconnectReader()
                    const {readers} = await StripeTerminal.discoverReaders({
                        type: TerminalConnectTypes.TapToPay,
                        locationId: apiStore.getStripeLocationId,
                    });
                    apiStore.setTerminalConnectingState(true)
                    await StripeTerminal.connectReader({
                        reader: readers[0]
                    });
                    apiStore.setTerminalConnectingState(false)
                    apiStore.setTerminalConnectedState(true)
                },
                async disconnect() {
                    await StripeTerminal.disconnectReader();
                    apiStore.setTerminalConnectedState(false)
                    apiStore.setTerminalConnectingState(false)
                }
Product Name: Product URL : Using Function:
- [ ] Payment Sheet / Payment Flow
 - [ ] Apple Pay
 - [ ] Google Pay
 - [ ] Identity (@capacitor-community/stripe-identity)
 - [ X] Terminal(@capacitor-community/stripe-terminal)